← Lessons

quiz vs the machine

Silver1080

System Design

Dead Letter Queues

Giving poison messages a safe place to land instead of blocking the line forever.

4 min read · intro · beat Silver to climb

The problem

In a message queue, most messages process cleanly. But some are poison messages: malformed payloads, references to deleted data, or bugs that throw every single time. If the consumer keeps retrying such a message, it can block the whole queue and burn resources forever.

The dead letter queue

A dead letter queue or DLQ is a separate queue where messages go after they fail too many times. Instead of retrying endlessly, the system gives up after a configured retry limit and moves the message aside.

  • The main queue keeps flowing for healthy messages.
  • Failed messages are preserved, not silently dropped.
  • Engineers can inspect, fix, and replay them later.

How it fits together

Each message carries a delivery count. When that count crosses a threshold, the broker routes it to the DLQ rather than back to the main queue.

A DLQ that fills up is a signal, not just a graveyard. Alert on its depth so a flood of failures is caught early.

Key idea

A dead letter queue isolates messages that fail repeatedly so one bad message cannot stall the whole pipeline.

Check yourself

Answer to earn rating on the learn ladder.

1. What is the main purpose of a dead letter queue?

2. Why should you alert on DLQ depth?