What is a Dead Letter Queue

A dead letter queue (DLQ) is a queue that receives messages that could not be successfully processed after a configured number of delivery attempts.

How it works

When a consumer fails to process a message (malformed data, missing dependency, bug), the message is requeued. After a threshold of failed attempts (e.g., 3 retries), the message broker moves the message to the DLQ instead of retrying again.

Without a DLQ, poison messages — messages that can never be processed — loop forever, consuming resources and blocking the queue.

Why it matters

DLQs prevent a single bad message from blocking all other messages in the queue. Engineers monitor the DLQ, inspect failed messages, fix the root cause (bug, schema change, missing data), and replay the messages back to the original queue.

Every production message queue should have a DLQ configured. RabbitMQ, Amazon SQS, Google Cloud Pub/Sub, and Kafka (via custom logic or error topics) all support dead letter handling.

For the full explanation, see How Message Queues Work.