[rabbitmq-discuss] current queue size is always different with a real queue size. actually, it is always same with actual queue size - prefetch size.

Henry JunYoung Kim henry.jykim at gmail.com
Fri Nov 16 07:28:39 GMT 2012


additionally, this is an initialization code for channels.

        channel = ConnectionManager.createChannel();

        

        logger.info("Setting basic.qos prefetch-count to " + prefetchCount);

        channel.basicQos(prefetchCount);


        consumer = *new* QueueingConsumer(channel);

        consumerTag = channel.basicConsume(queueName, autoAck, consumer);

        

        logger.info("Consuming a queue '" + queueName + "'");

2012년 11월 16일 금요일 오후 4시 27분 24초 UTC+9, Henry JunYoung Kim 님의 말:
>
> hi, 
>
> I am a newbie to use a rabbitmq. 
>
> currently, I am using it without no auto-ack mode. 
>
> manually, I send  ack/nack after receiving messages from queues.
>
> but, on this, I found that current queue size is always different with a 
> real queue size. actually, it is always same with actual queue size - 
> prefetch size. 
>
> here is my code to send. 
>
>         channel.basicPublish(exchangeName, queueName, *null*, message);
>
>         System.out.println(channel.queueDeclarePassive(queueName).getMessageCount()); 
> // for debugging
>
> If I set the prefetchCount as 5. it prints out 
>
> 0
>
> 0
>
> 0
>
> 0
>
> 0
>
> 1
>
> 2
>
> 3
>
> 4
>
> .....
>
> If I set it as 3, it prints out
>
> 0
>
> 0
>
> 0
>
> 1
>
> 2
>
> 3
>
> 4
>
> ..
>
>
> How could I retrieve the correct queue size regardless of the 
> prefetchCount.
>
>
> thanks for your concerns.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20121115/720e68da/attachment.htm>


More information about the rabbitmq-discuss mailing list