Cron or Message Queue Scheduling for 10,000 Delayed Webhook Tasks (and Retry Rules)
Short answer: use a durable queue message for each reservation expiry, and keep a small cron scan as a repair path. The queue gives every delayed webhook task its own retry and idempotency boundary; cron remains useful for finding records whose scheduling transaction was interrupted. Neither mechanism should own a long-running job or hide an unreliable public HTTPS endpoint. Here is the decision…
The article discusses the choice between using a cron scanner or a delayed message queue for scheduling 10,000 delayed webhook tasks, along with retry rules. The recommended approach is to use a durable queue message for each reservation expiry, with a small cron scan as a repair path. The queue ensures that each delayed webhook task has its own retry and idempotency boundary, while the cron remains useful for finding records whose scheduling transaction was interrupted.
Neither mechanism should own a long-running job or hide an unreliable public HTTPS endpoint. The article also provides a decision matrix for determining the best approach based on specific requirements and a code example demonstrating how to implement the suggested solution using the transactional outbox pattern and conditional updates to handle message duplication.
Brief written by urgent.news from Dev.to's own syndicated text. Machine-written — may contain errors; check the original before relying on it.