[rabbitmq-discuss] checking no of message in queue
shammi at arosys.com
Tue Mar 22 10:34:20 GMT 2011
I am using the QueueingConsumer and using the following code for the
delivery = consumer.nextDelivery(500);
I am using java library for this and how can i get in this case the number
Emile Joubert-2 wrote:
> Hi cheepu,
> Op 22/03/2011 09:01, het cheepu geskryf:
>> I am checking the number of message in the queue.
>> I am using the fillowing code for this.
>> channel.exchangeDeclare("exchange", "direct",true);
>> I am using the same connection object. but the channel for both task is
>> I started two thread( consumer thread to consume msg from queue and a
>> to check no of message in queue) which are running continuously but I can
>> pause and stop the consumer thread.
>> I did the following steps:
>> 1. Produced 20 message
>> Result: queue depth is 0 because all the messages are consumed by the
>> consumer thread
>> This is expected result.
>> 2. Next I paused the consumer thread. and then again produced 20 message.
>> Result: queue depth is 0( This is unexpected because there are 20
>> in queue) and message is not consumed by the consumer thread( because
>> are paused ).
>> 3. Next I stopped the consumer:
>> Result: Now I am getting the no of message in the queue ie 20.
>> Why when the consumer is sleeping then my queue size ( ie message in
>> is zero?
> This could happen if you are using the QueueingConsumer in auto-ack
> mode, because the the QueueingConsumer will accept messages from the
> broker and store them in memory on the client. You don't say exactly
> what the consumer thread does - if it just dequeues messages from the
> QueueingConsumer then that is a possible explanation for your
> You can use the following command before and after each of your 3 steps
> to confirm:
> rabbitmqctl list_queues name messages messages_ready
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
View this message in context: http://old.nabble.com/checking-no-of-message-in-queue-tp31208079p31208529.html
Sent from the RabbitMQ mailing list archive at Nabble.com.
More information about the rabbitmq-discuss