[rabbitmq-discuss] Java client getMessageCount problem

Matthias Radestock matthias at rabbitmq.com
Tue Feb 15 12:51:22 GMT 2011


Isaías,

On 14/02/11 08:59, Isaías Espejo Badia wrote:
> I have a queue declared how passive and I am using the getMessageCount
> method but this method return 0 although queue has one element.
> [...]
> is there other way to count the queue elements that show the real
> elements? (elements waiting for ack and when only there is a element)

Messages that have been delivered to a client and are pending 
acknowledgement are not included in the count in queue.declare-ok. 
That's because it would be surprising to, say, get back a count of 1 and 
then find that basic.get returns 'empty'.

You can get the unacked count via 'rabbitmqctl list_queues' or the 
management plugin. It's rarely something that is useful in an 
application since it is so ephemeral. What are you trying to accomplish?


Regards,

Matthias.


More information about the rabbitmq-discuss mailing list