[rabbitmq-discuss] time to live on a durable message

Michael Klishin mklishin at gopivotal.com
Tue Oct 15 19:13:01 BST 2013


On 15 Oct 2013, at 21:58, "PATAR, SAGAR" <sp345s at att.com> wrote:

> Is there a way we can define time to live on a message published to a durable exchange ..

Yes, and, in fact, on any message. See Per-Message TTL on
https://www.rabbitmq.com/ttl.html

>  
> What happens when a message binding key doesn’t matches any binding ..


> does it stay in the durable exchange till the time to live is expired ..

Messages are not stored in exchanges. Exchanges act as routing tables that move messages
to one or more queues. If TTL has expired, a message is deleted from the queue.

>  
> Scenario 1:
> Let’s say we have a time to live of 2 hr for a message and its published to a durable exchange with no binding Key match (ex: binding key = NoMatch) … after 1 hr let’s say a  client subscribes for messages with bindingKey =”NoMatch” on that exchange .. will the message be delivered to the client ?? 

If the message was routed to a queue with TTL = 2h and consumer comes around in 1h, then it will be delivered.


> Scenario 2:
> Let’s say we have a time to live of 2 hr for a message and its published to a durable exchange with a binding key match (ex: binding key = match)  and the message will be routed to a queue and is consumed by a client .. After 1 hr If a new client subscribes for the messages with bindingKey =”match” by creating a new Queue ..will the new client get the  same message

No, standard exchanges do not keep a history of messages, so newly bound queues only get messages
published after the binding is set up.


MK





More information about the rabbitmq-discuss mailing list