Dead-letter queue
Amazon SQS dead-letter queue
Where messages go after failing N times, so they stop blocking or retrying forever.
In a monolith
Failed jobs list
Job frameworks keep a “failed” list you can inspect and retry by hand.
In a distributed system
Redrive target per queue
Every important queue has a DLQ with an alarm; engineers inspect, fix the bug, then redrive messages back.
On AWS
Amazon SQS dead-letter queue
A regular SQS queue set as the redrive target after maxReceiveCount; DLQ redrive moves messages back to the source queue.
- SQS DLQ + CloudWatch alarm$Alarm when visible messages > 0
- Reach for it when
- Every queue whose messages matter.
- What it costs you
- Someone must own and drain it
- Messages expire if retention runs out
- When it dies
- Without one, poison messages retry forever (burning workers) or, in FIFO queues, block everything behind them.
Interview follow-ups
What is a poison message?
A message that always fails (bad data, a bug). Without a DLQ it’s retried endlessly, wasting capacity and blocking its FIFO group.
Connection rules
It talks to
- ServiceOnly when: A separate consumer that inspects or replays failed messages — usually manual or alarm-driven.
- WorkerOnly when: A separate consumer that inspects or replays failed messages — usually manual or alarm-driven.
- QueueOnly when: Redrive: after the bug is fixed, failed messages go back to the source queue.
Gets traffic from
Never
- Clients → DLQClients can’t be trusted to enqueue directly — there’s no validation or auth in between.
- App server → DLQProducers publish to the main queue; the broker moves failures to the DLQ.
- Service → DLQProducers publish to the main queue; the broker moves failures to the DLQ.
- Worker → DLQProducers publish to the main queue; the broker moves failures to the DLQ.