[rabbitmq-discuss] problem on queue depth checking?

Simon MacMullen simon at rabbitmq.com
Tue Mar 13 13:07:15 GMT 2012

On 13/03/12 13:01, sameekmishra wrote:
> Now if i publish 2 messages then one message will be consumed(and thread
> will sleep for one minute) and one will be in the queue;
> And queue depth checking thread must show the queuedepth = 1. But I am
> getting the queuedepth 0.
> But if we dont consume the message from queue then queuedepth is shown
> correctly.

RabbitMQ will by default push as many messages to the consumer as it 
can. On the consumer side they end up buffered in the QueueingConsumer.

To change this behaviour, invoke channel.basicQos() and use acks. This 
will bound the number of unacknowledged messages RabbitMQ will push to 
your consumer.

Cheers, Simon

Simon MacMullen
RabbitMQ, VMware

More information about the rabbitmq-discuss mailing list