feat: implement event bus backend configuration for DB and NATS

This commit is contained in:
2026-05-10 17:55:51 +02:00
parent dca50b46d1
commit c2a5541706
7 changed files with 109 additions and 42 deletions

View File

@@ -39,17 +39,18 @@ ALLOW_REGISTRATION=false
RATE_LIMIT=20
POSTER_FETCH_TIMEOUT_SECONDS=30
# Event bus — controls background poster sync and other async work.
# Priority: NATS (if NATS_URL set) → DB queue (default, uses existing DB)
# Event bus — "db" (default) or "nats"
# The worker binary must run alongside the presentation to process events.
EVENT_BUS_BACKEND=db
# Option A: DB queue (default — no extra infrastructure needed)
# Events are stored in the same database as the app and polled by the worker.
# Events are persisted in the same database as the app and polled by the worker.
# EVENT_QUEUE_POLL_INTERVAL_MS=500 # polling interval (default: 500ms)
# EVENT_QUEUE_BATCH_SIZE=10 # rows claimed per poll cycle (default: 10)
# EVENT_QUEUE_MAX_ATTEMPTS=5 # retries before dead-lettering (default: 5)
# Option B: NATS (at-least-once delivery, recommended for higher throughput)
# EVENT_BUS_BACKEND=nats
# NATS_URL=nats://localhost:4222
# NATS_MODE=jetstream # "jetstream" (default, at-least-once) or "core" (fire-and-forget)
# NATS_SUBJECT_PREFIX=movies-diary.events