[rabbitmq-discuss] Ending a computation when the queue runs out of items

Simon MacMullen simon at rabbitmq.com
Tue Jun 26 11:35:42 BST 2012


On 25/06/12 12:27, Rafael Calsaverini wrote:
> I want the process to stop when I run out of items

I assume you mean "when the queue becomes empty" - obviously there's 
nothing to stop a publisher publishing more work even after a queue has 
been drained.

There's no way to get immediately notified that a queue is empty as a 
client. The best you can do is have your consumer keep redeclaring the 
queue occasionally, and looking at the queue.declare-ok to see how many 
messages the queue claims to have.

Cheers, Simon

-- 
Simon MacMullen
RabbitMQ, VMware


More information about the rabbitmq-discuss mailing list