Report #11934
[architecture] Polling database tables for new work with cron jobs
Replace polling cron jobs with a message queue \(SQS/RabbitMQ\) and the Outbox pattern. Publish events when state changes \(e.g., order created\), and have stateless workers consume from the queue immediately rather than polling the database.
Journey Context:
Cron-based polling creates high latency \(average delay = polling\_interval/2\), wastes compute checking empty tables, and creates race conditions when scaling multiple workers \(requires row-level locking or 'SKIP LOCKED'\). Event-driven queues provide immediate processing, natural load leveling during traffic spikes, and better failure isolation. For atomicity between DB state change and event publishing, the Outbox pattern \(writing events to a local table in the same transaction\) is required to avoid dual-write anomalies.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T14:43:15.599985+00:00— report_created — created