[rabbitmq-discuss] Scheduled Message Delivery

Steve Powell steve at rabbitmq.com
Fri Mar 30 14:28:00 BST 2012


James, 

There is no such thing as a dead-letter queue. Just dead-letter
exchanges.

You never attached any consumers to the 'send.later' queue which has the
delayed messages, and the broker certainly doesn't attach any, so an
auto-delete event will never get triggered for that queue.

The act of transferring the messages from 'send.later' to the 'real' one
when the messages expire doesn't use consumers, and the broker is not
"maintaining a connection" to it.  The x-expires argument on the queue
is the right solution, but for the wrong reason; the auto-delete option
is not necessary.

Steve Powell
steve at rabbitmq.com
[wrk: +44-2380-111-528] [mob: +44-7815-838-558]

On 30 Mar 2012, at 12:59, James Carr wrote:

> Yeah, my suspicion is the broker might be a consumer when the queue is
> dead lettered. Because until I defined it as a dead letter queue it
> disappeared as soon as my consumer went away.
> 
> Still pretty cool though. I like it. :)
> 
> Thanks,
> James
> 
> 
> On Fri, Mar 30, 2012 at 5:29 AM, Steve Powell <steve at rabbitmq.com> wrote:
>> Fascinating James,
>> 
>> I think the reason the queue stays around (even though you specify
>> auto-delete) is because auto-delete on queues is designed to be
>> triggered when the last consumer is cancelled. If there are never any
>> consumers for the queue this event never occurs and the queue stays
>> around. (If this wasn't the case, an auto-delete queue could disappear
>> as soon as it was created!). It's all in the spec  :-)
>> 
>> Steve Powell
>> steve at rabbitmq.com
>> [wrk: +44-2380-111-528] [mob: +44-7815-838-558]
>> 
>> On 30 Mar 2012, at 07:42, James Carr wrote:
>> 
>>> Hey All,
>>> 
>>> I thought I'd share a neat "trick" I came up with lately to "schedule"
>>> messages to be delivered at a specific duration. I had a lot of
>>> polling going on in my application for things like scheduling
>>> callbacks with leads and was getting sick of having to add even more
>>> interval based polling each time a new feature came along.
>>> 
>>> So here's an example of what I'm doing to schedule messages to be
>>> delivered at a time in the future:
>>> https://github.com/jamescarr/rabbitmq-scheduled-delivery. It makes
>>> interesting use of x-message-ttl and x-dead-letter-exchange. :)
>>> 
>>> Cheers,
>>> James
>>> _______________________________________________
>>> rabbitmq-discuss mailing list
>>> rabbitmq-discuss at lists.rabbitmq.com
>>> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>> 



More information about the rabbitmq-discuss mailing list