Introduce seed-telegrams tool for generating synthetic telegrams for testing and development. Enhance README with detailed usage instructions, command-line parameters, and examples. Add unit tests for telegram generation and status selection logic to ensure robustness. Update documentation to reflect new features and usage scenarios.

This commit is contained in:
windyboy
2025-11-16 17:24:16 +08:00
parent 06b2495d77
commit 12fda00df9
9 changed files with 730 additions and 80 deletions
+11 -1
View File
@@ -169,7 +169,17 @@ func (p *MessageProcessor) Handle(ctx context.Context, raw []byte, msgID string)
p.telemetry.RecordFailure("publisher")
p.telemetry.RecordProcessingResult(ctx, string(parsed.Status), parsed.Category, latency)
p.persistRaw(ctx, parsed)
// Mark as permanent so the consumer will ack instead of retrying
// Treat clearly temporary JetStream issues (e.g. no responders) as transient so
// the consumer will NAK and retry according to backoff settings.
lowerErr := strings.ToLower(err.Error())
if strings.Contains(lowerErr, "no responders") {
pubSpan.End()
// Return a non-permanent error to trigger retry via nakWithStrategy in the consumer.
return fmt.Errorf("transient publish error: %w", err)
}
// Other publish errors are treated as permanent and will go to DLQ + ACK.
pubSpan.End()
return Permanent(fmt.Errorf("failed to publish message: %w", err))
}