feat: add SQLite and PostgreSQL event queue adapters with migrations

This commit is contained in:
2026-05-10 17:46:16 +02:00
parent 37b0e07055
commit dca50b46d1
10 changed files with 45 additions and 13 deletions

View File

@@ -38,12 +38,22 @@ SECURE_COOKIES=false
ALLOW_REGISTRATION=false
RATE_LIMIT=20
POSTER_FETCH_TIMEOUT_SECONDS=30
EVENT_CHANNEL_BUFFER=128
# NATS event bus (optional — falls back to in-memory channel when unset)
# Event bus — controls background poster sync and other async work.
# Priority: NATS (if NATS_URL set) → DB queue (default, uses existing DB)
# The worker binary must run alongside the presentation to process events.
# Option A: DB queue (default — no extra infrastructure needed)
# Events are stored 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)
# NATS_URL=nats://localhost:4222
# NATS_MODE=jetstream # "jetstream" (default, at-least-once) or "core" (fire-and-forget)
# NATS_SUBJECT_PREFIX=movies-diary.events
# NATS_STREAM_NAME=MOVIES_DIARY_EVENTS
# NATS_CONSUMER_NAME=worker
RUST_LOG=presentation=debug,tower_http=debug
RUST_LOG=presentation=debug,tower_http=debug,worker=info,application=info