[rabbitmq-discuss] Reliable way to get number of messages in a queue

Matthew Sackman matthew at lshift.net
Fri Oct 23 18:17:54 BST 2009


On Fri, Oct 23, 2009 at 11:41:46AM -0500, Mark Nutter wrote:
> I'm attempting to get the number of messages that are in a queue.  I'm using
> a consumer to pull messages from the queue.  I've tried using the
> queueDeclare getMessageCount() function and that gives me the message count
> *once* but every time after that it just gives me a message count of zero
> back.  Any other way of finding it?  Is the consumer somehow messing things
> up?  Thanks!

If the consumer has removed all the msgs from the queue, then the
queueDeclare msg count will indeed be 0. The queueDeclare msg count only
tells you the number of messages currently buffered in the queue.

Matthew




More information about the rabbitmq-discuss mailing list