AMQP Dead Letter Exchange Workbench

Trace how failed AMQP messages leave a source queue, pass through a DLX, and arrive in a dead letter queue with useful evidence.

animation
amqp
protocols
messaging
dead-letter
reliability
Interactive AMQP dead letter exchange animation showing rejected messages, TTL expiry, queue length overflow, quorum queue delivery limits, dead-letter routing keys, x-death headers, and DLQ triage decisions.
AMQP Dead lettering IoT reliability

AMQP Dead Letter Exchange Workbench

Follow one message from a producer into a source queue, then decide whether it is acknowledged, rejected, expired, overflowed, or sent to a dead letter exchange for inspection. The goal is to see that a DLX is not just a separate queue: it is a normal exchange used for the second publish.

Dead-lettered current outcome
rejected x-death reason
failed.telemetry DLX routing key
DLQ 1 dead letter queue depth
1. Source queue Messages die while they are in a queue.

The DLX policy belongs to the source queue, not to the producer. The queue decides where failed messages go.

2. Triggers Only specific conditions dead-letter a message.

Rejected with requeue=false, TTL expiry, queue length overflow, and quorum delivery limit are the core cases.

3. Routing The DLX republishes with a routing key.

A queue can override the key with x-dead-letter-routing-key; otherwise original routing keys are used.

4. Evidence The DLQ is for triage, not storage forever.

Inspect x-death, fix the cause, then retry, archive, or discard with intent.

Scenario controls

Use presets first, then adjust the broker conditions to test edge cases.

ready
Presets
Playback
Disposition
Timing and pressure
6000 ms
9000 ms
6 messages
10 messages
1 attempt
5 attempts

Message path

The producer publishes a telemetry message with routing key sensor.room1.temp.

stage 1
AMQP dead letter exchange message flow A visual path from producer to source exchange, source queue, consumer, dead letter exchange, dead letter queue, and triage decision. Producer sensor app main.x direct telemetry.q source queue policy Consumer rejects body dlx.iot direct failed.q DLQ receives 1 Triage decision inspect x-death Source queue policy dead-letter-exchange=dlx.iot, dead-letter-routing-key=failed.telemetry x-death preview reason=rejected, count=1 M Reject without requeue: route through DLX The queue republishes the message to dlx.iot using failed.telemetry.
Rejected messages are dead-lettered only when requeue=false.

The consumer refused the message and did not ask the broker to put it back in the source queue.


    
Trigger Consumer rejection

The message becomes a dead letter because the consumer rejected it with requeue=false.

Routing Override key in use

The DLX publish uses failed.telemetry, so the failed queue binding can be simple and predictable.

Risk DLQ can grow silently

Monitor DLQ depth and alert when failures appear faster than triage can process them.

Next action Inspect then retry

Use the failure reason and original routing keys before deciding whether retry is safe.

Do not confuse DLX and DLQ are different things.

The DLX is an exchange. The DLQ is just a queue bound to that exchange. Routing still depends on bindings and routing keys.

Requeue flag requeue=true is not dead lettering.

A rejected message with requeue=true returns to a queue and may be redelivered; it does not go to the DLX at that moment.

TTL nuance Expired messages are removed when the queue processes them.

TTL is not always visible as an instant timer pop; messages may wait behind older messages until they reach the head.

Operational safety DLX publishing can still fail.

Keep the target exchange and queue available, and use quorum at-least-once dead lettering when the safety requirement demands it.

Decision trace

reject/nack

Dead-letter only when: consumer sends basic.reject or basic.nack with requeue=false.

TTL

Expired when: message age is greater than or equal to the lower applicable queue or per-message TTL.

maxlen

Overflow when: queue length exceeds the configured message or byte limit, so messages are dropped or dead-lettered.

delivery_limit

Quorum only: a poison message is dead-lettered after more returns than the configured quorum delivery limit.

routing key

DLX publish uses: x-dead-letter-routing-key if configured, otherwise the original routing keys.

x-death

Evidence records: queue, reason, count, exchange, routing keys, and first/last death fields.

AMQP DLX quick reference
Queue policy keys

Prefer policies such as dead-letter-exchange and dead-letter-routing-key so operators can change routing without redeclaring application queues.

Optional queue arguments

Applications can declare x-dead-letter-exchange and x-dead-letter-routing-key, but those hard-coded arguments are harder to change later.

Dead-letter reasons

Use the exact reason names rejected, expired, maxlen, and delivery_limit when teaching or building dashboards.

Routing failure

If the DLX does not exist when the message must be dead-lettered, the message can be dropped. If no binding matches, normal exchange routing rules apply.

Retry design

Retries should usually go through a separate retry queue or controlled republish path, not blind automatic loops that hide poison messages.

IoT examples

DLQs are useful for malformed telemetry, commands that expired before delivery, burst overflow archives, and repeated device-specific processing failures.