Declare a dead-letter exchange (DLX) as a normal exchange (direct or fanout) and a corresponding dead-letter queue bound to it
When declaring the primary queue, set the x-dead-letter-exchange argument to the DLX name and optionally x-dead-letter-routing-key
Messages are dead-lettered on nack with requeue=false, rejection, or TTL expiry; no extra code is needed on the consumer side
Optionally set x-message-ttl on the primary queue so unacknowledged or unprocessed messages expire and flow to the DLX automatically
Consume from the dead-letter queue for inspection, alerting, or manual replay into the primary queue
Known gotchas
Dead-lettering creates a cycle risk: if the DLX routes back to the same queue, messages loop infinitely; always route DLX to a separate queue
The x-death header is appended each time a message is dead-lettered and grows unboundedly if the message cycles; inspect it to detect loops
Per-message TTL (expiration property) interacts with per-queue TTL (x-message-ttl); the shorter of the two takes effect, which can cause unexpected early dead-lettering
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp