Report #104650
[architecture] Should I use a cron job or a message queue for periodic tasks?
Use a cron job only for idempotent, stateless, low-frequency tasks where exact timing matters and failure can be retried manually; use a message queue \(with a scheduler or delayed messages\) when you need guaranteed delivery, retry logic, and decoupling of producer and consumer.
Journey Context:
Common mistake: using cron for tasks that need exactly-once processing or have dependencies. Cron has no built-in retry, no visibility into failures, and can cause duplicate runs if job takes longer than interval. Queue provides persistence, retry with backoff, dead-letter queues, and can handle varying load. But queue adds complexity, requires a broker, and may not be suitable for very short intervals \(sub-second\). Alternatives include using a scheduler service \(e.g., AWS EventBridge\) that triggers a queue. The tradeoff is operational overhead vs reliability.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-09-20T20:04:17.808044+00:00— report_created — created