129 lines
4.2 KiB
TOML
129 lines
4.2 KiB
TOML
[nats]
|
|
url = "nats://localhost:4222"
|
|
# mode: "core" (default for dev) or "jetstream" (recommended for production)
|
|
# - "core": Uses Core NATS for simple pub/sub messaging with:
|
|
# * No message persistence (messages lost if consumer offline)
|
|
# * No ACK mechanism (fire-and-forget delivery)
|
|
# * No automatic retry on processing failures
|
|
# * Queue groups for load balancing only
|
|
# * Suitable for development/testing or real-time scenarios where message loss is acceptable
|
|
# * Recommended for local development and testing
|
|
# - "jetstream": Uses NATS JetStream for persistent message streaming with:
|
|
# * 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
|
|
# * Recommended for production environments
|
|
mode = "jetstream"
|
|
client = "serial-client"
|
|
cluster = "tele-cluster"
|
|
stream = "TELEGRAM"
|
|
consumer = "telegram-consumer"
|
|
|
|
[nats.stream_limits]
|
|
# Stream retention and storage limits (only applies when mode = "jetstream")
|
|
# 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 (only applies when mode = "jetstream")
|
|
# 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 (applies to both core and jetstream modes)
|
|
# 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 (only applies when mode = "jetstream")
|
|
# 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"
|