[rabbitmq-discuss] Hi, question about Scheduled Message Delivery

Matthias Radestock matthias at rabbitmq.com
Fri Nov 30 14:42:09 GMT 2012


Randall,

On 29/11/12 13:23, Randall Richard wrote:
> Regarding the caveats and triggering expiry only on a message at the
> head of the queue, are there plans to support message expiration
> independent of position in queue?

No concrete plans, though we do of course recognise that this is a 
feature some users may want.

> Just to clarify on the current 3.0 implementation, if I understand this
> correctly, this means that if I have two unconsumed messages (e.g. the
> queue's consumer has disappeared for several minutes) where the first
> message has no TTL and the second has a 5 second TTL, this 5 second TTL
> message will not be dead lettered until the non-TTL message is consumed?

Correct.

So to use the existing TTL facilities for scheduled message delivery you 
need to be able to place the messages in queues s.t. their expiries are 
monotonically increasing.

Depending on the range and granularity at which you want scheduled 
delivery to take place, you may be able to construct a chained set of 
queues and dead letter exchanges to get messages delivered at the 
desired schedule.

E.g. if your scheduling range was 10 hours at a granularity of 5 minutes 
you could have an "hours" exchange, with a "0h", "1h", "2h", ... "9h" 
queues that all dead-letter to a "minutes" exchange with "0m", "5m", ... 
"55m" queues that all dead-letter to a final exchange which then routes 
messages to their ultimate destinations.

It's a bit fiddly, but you only have to set this up once and then never 
touch it again. And for the sender things are simple - they just send 
messages with a routing key of "5h.10m" (the "hours" exchange would 
route on the first part, the "minutes" exchange on the second part).


Regards,

Matthias.


More information about the rabbitmq-discuss mailing list