Build a Queue Worker with Backoff and a Dead-Letter Queue
OtherSoftware Engineer · OnsiteLast updated
Design queue-worker retries with exponential backoff, durable delayed delivery, attempt limits, idempotent effects, and dead-letter replay, including AI-code validation.
Constraints & Assumptions
This is a real worker-lifecycle and failure-handling exercise. The source does not specify a broker, language, retry count, or persistence guarantees. State your delivery and retry semantics before coding. AI-assisted drafting is part of the reported discussion, not a substitute for understanding the result.
Clarifying Questions
Does the limit count attempts or retries? Which errors are retryable? What happens if a worker crashes after a task effect but before acknowledgment? How durable must delayed retries and the dead-letter queue be?
Follow-up questions
- How would you cap and jitter the delay? What information belongs in a dead-letter record? How would you safely replay it after a bug fix?
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.