[rabbitmq-discuss] To know when a queue is empty from a Java client

Michael Bridgen mikeb at rabbitmq.com
Thu Aug 26 14:24:25 BST 2010

>  From a Java client we need to know when a queue is empty.
> Is there a way to know it via the Java api (or to know the number
> of messages in a queue).
> We would rather have another way than calling /"rabbitmqctl list_queues"/
> via Runtime.exec()

A queue.declare_ok frame includes the number of messages on the queue; 
so, you could send a passive queue.declare, and examine the response.


More information about the rabbitmq-discuss mailing list