[rabbitmq-discuss] How to get notification when a queue becomes non-empty without removing any messages?

Laing, Michael michael.laing at nytimes.com
Tue Sep 10 00:43:11 BST 2013


Why don't you just subscribe to that queue with basic.consume, acks on, and
a prefetch of 1

When you get a message, reject it and cancel your consumer (if your logic
calls for it).

The message will be at the front of the queue.

Then spawn your 'consumer process'. The message (and any others) will be
there waiting.

I use python pika async to do this sort of thing. Event driven, no polling.

If speed is important, use the tornado adapter; if you are feeling lucky,
use the libev adapter (full disclosure: I wrote it)

-ml


On Mon, Sep 9, 2013 at 7:20 PM, vitaly <vitaly.krugl.numenta at gmail.com>wrote:

> I need to be able to spawn a consumer process for a queue when that queue
> becomes non-empty. The trigger needs to happen in an event-driven way,
> without polling, and without removing any messages from that queue. Is this
> possible with AMQP/RabbitMQ and how?  I am coding in Python.
>
> Thank you,
> Vitaly
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130909/d8f8e630/attachment.htm>


More information about the rabbitmq-discuss mailing list