[nats] url = "nats://localhost:4222" # mode: "jetstream" (required - only JetStream mode is supported) # JetStream provides: # * Message persistence and replay capability # * ACK/NAK mechanism for guaranteed delivery # * Automatic retry with configurable backoff # * Dead-letter queue (DLQ) support # * Batch processing and consumer monitoring mode = "jetstream" client = "serial-client" cluster = "tele-cluster" stream = "TELEGRAM" consumer = "telegram-consumer" [nats.stream_limits] # Stream retention and storage limits # max_msgs: Maximum number of messages to keep in the stream (0 = unlimited) max_msgs = 100000 # max_bytes: Maximum total size of messages in bytes (0 = unlimited, 67108864 = 64MB) max_bytes = 67108864 # max_age: Maximum age of messages before automatic deletion (e.g., "24h", "7d") max_age = "24h" # discard: What to do when limits are reached: "old" (delete oldest) or "new" (reject new) discard = "old" # storage: "file" (persistent to disk) or "memory" (ephemeral, faster but lost on restart) storage = "file" # replicas: Number of stream replicas for high availability (1 = single node, 3+ for production cluster) replicas = 1 [nats.consumer_rules] # Consumer delivery rules # max_deliver: Maximum number of delivery attempts before giving up (0 = unlimited) max_deliver = 3 # ack_wait: Time to wait for ACK before redelivering message (e.g., "30s", "2m") ack_wait = "30s" # max_ack_pending: Maximum number of unacknowledged messages before pausing delivery max_ack_pending = 1000 [nats.auth] # NATS authentication configuration (optional for development) # token: Simple token authentication (uncomment if needed) # token = "your-dev-token" # TLS configuration (optional - uncomment for secure connections) # tls_enabled = true # tls_cert_file = "/path/to/client.crt" # tls_key_file = "/path/to/client.key" # tls_ca_file = "/path/to/ca.crt" [subscription] topic = "telegram.serial" queue_group = "tele-queue" [publisher] topic = "telegram.json" [timeouts] server = "5s" reconnect_wait = "5s" close = "10s" ack_wait = "5s" [postgres] url = "postgres://caatsm:caatsm@localhost:5432/aviation?sslmode=disable" max_conns = 10 min_conns = 2 [app] # Batch processing configuration # batch_size: Number of messages to fetch in each batch (JetStream pull batch size) batch_size = 50 # batch_timeout: Maximum time to wait when fetching a batch (e.g., "2s") batch_timeout = "2s" # monitor_interval: How often to emit consumer statistics and metrics monitor_interval = "30s" [log] level = "info" format = "console" output = ["stdout", "file"] file = "logs/caatsm.log" # File rotation settings max_size = 100 # MB max_backups = 7 # Keep 7 rotated files max_age = 30 # Keep logs for 30 days compress = true # Compress old log files # Advanced options disable_caller = false disable_stacktrace = false development = false # Sampling configuration (optional, for high-volume scenarios) # [log.sampling] # initial = 100 # Log first 100 messages # thereafter = 100 # Then log every 100th message # tick = "1s" # Per second [telemetry] enabled = true endpoint = "localhost:4318" insecure = true [monitoring] disabled = false addr = ":2112" enable_metrics = true enable_health = true read_timeout = "5s" write_timeout = "5s" health_timeout = "2s" [dlq] # Dead-Letter Queue configuration # enabled: Enable DLQ routing for poison messages (messages that fail after max_deliver attempts) enabled = true # Set to true when switching to JetStream mode # subject: NATS subject where failed messages will be published for manual inspection subject = "caatsm.dlq" [aftn] # AFTN Protocol Validation and Monitoring # validation_enabled: Enable AFTN protocol validation for telegrams (disabled by default for safe rollout) validation_enabled = false # message_gap_threshold: Duration after which serial reader is considered stalled (no messages received) message_gap_threshold = "2m" # enable_sequence_gap_detection: Monitor for missing sequence numbers in telegram stream enable_sequence_gap_detection = true