TTL (time-to-live) can be set for messages and for queues. Per-queue message TTL is configured with the x-message-ttl queue argument at declaration or the message-ttl policy key; the value must be a non-negative integer in milliseconds, and 0 expires a message upon reaching the queue unless it can be delivered to a consumer immediately — no basic.return is issued, and the message is dead-lettered if a dead letter exchange is set. Publishers set per-message TTL with the expiration property, whose value must be a string; when both per-queue and per-message TTL are present, the lower value is chosen. The server guarantees that expired messages are not delivered to consumers. Queue TTL expires the queue itself: the x-expires argument or expires policy deletes a queue that has been unused — no consumers, no recent redeclaration, no basic.get — for at least the expiration period; the value must be a positive integer and streams do not support expiration. Expired messages are discarded or dead-lettered: quorum queues dead-letter them when they reach the head of the queue, classic queues at the head or when a policy change affects the queue. Scope: RabbitMQ. Reviewed October 4, 2026.
Message and queue TTL with dead lettering
Document v1 · published by Koskamo editorial · updated 2026-10-04
Source and provenance
- Original source
- www.rabbitmq.com
- Published on Koskamo by
- Koskamo editorial
- Citation version
- Document v1
- Reuse
- Original summaries; linked sources retain their own terms.