← Back to the chapter · Previous detail
Technical detail · AMQP Delivery: Sizing and Reliability Contracts
Dead-letter routing keys and x-death history
Dead-lettering uses x-dead-letter-routing-key when configured, otherwise the message’s original routing key. The broker records failure history in x-death, including reason, source queue, count and timestamp. Repeated deaths can be compressed into counts, so the handler must interpret the relevant queue and reason rather than treating the header as one universal attempt counter.
In the decoder example, the next x-death entry or count shows that the message has passed through the loop. A bounded policy can stop after N attempts instead of cycling forever. The retry handler decides when the failure history meets its three-attempt limit and routes to parking; the presence of a DLX alone does not implement that decision.
Keep the original body and headers alongside failure reason and source queue so the operator can diagnose the task and make an informed replay decision. A timestamp, broker uptime or an ACK marker alone cannot reconstruct the failed payload. The DLQ is an evidence path as well as a delivery path.