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
+6
View File
@@ -5,7 +5,9 @@ import (
"caatsm/internal/infra/config"
"caatsm/internal/model"
"encoding/json"
"errors"
"fmt"
"github.com/google/uuid"
"github.com/nats-io/nats.go"
"go.uber.org/zap"
@@ -62,6 +64,10 @@ func (p *Publisher) Publish(message interface{}) error {
// Publish to JetStream
_, err = p.js.PublishMsg(jsMsg)
if err != nil {
// Distinguish temporary JetStream unavailability from permanent config errors.
if errors.Is(err, nats.ErrNoResponders) {
return fmt.Errorf("transient publish error (no responders): %w", err)
}
return fmt.Errorf("failed to publish message: %w", err)
}