additionally, this is an initialization code for channels.<div><br></div><div>
<p class="p1"> <span class="s1">channel</span> = ConnectionManager.createChannel();</p>
<p class="p2"> </p>
<p class="p3"><span class="s2"> </span><span class="s1">logger</span><span class="s2">.info(</span>"Setting basic.qos prefetch-count to "<span class="s2"> + </span><span class="s1">prefetchCount</span><span class="s2">);</span></p>
<p class="p1"> <span class="s1">channel</span>.basicQos(<span class="s1">prefetchCount</span>);</p>
<p class="p2"><br></p>
<p class="p1"> <span class="s1">consumer</span> = <span class="s3"><b>new</b></span> QueueingConsumer(<span class="s1">channel</span>);</p>
<p class="p4"><span class="s2"> </span>consumerTag<span class="s2"> = </span>channel<span class="s2">.basicConsume(</span>queueName<span class="s2">, </span>autoAck<span class="s2">, </span>consumer<span class="s2">);</span></p>
<p class="p2"> </p>
<p class="p3"><span class="s2"> </span><span class="s1">logger</span><span class="s2">.info(</span>"Consuming a queue '"<span class="s2"> + </span><span class="s1">queueName</span><span class="s2"> + </span>"'"<span class="s2">);</span></p><br>2012년 11월 16일 금요일 오후 4시 27분 24초 UTC+9, Henry JunYoung Kim 님의 말:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<p>hi, </p><p>I am a newbie to use a rabbitmq. </p><p>currently, I am using it without no auto-ack mode. </p><p>manually, I send ack/nack after receiving messages from queues.</p><p>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. </p><p>here is my code to send. </p><p> <span>channel</span>.basicPublish(<span>exchang<wbr>eName</span>, <span>queueName</span>, <span><b>null</b></span>, message);</p>
<p> System.<span>out</span>.println(<span>channel</span>.<wbr>queueDeclarePassive(<span>queueName</span>)<wbr>.getMessageCount()); // for debugging</p><p>If I set the prefetchCount as 5. it prints out </p><p>0</p><p>0<br></p><p>0<br></p><p>0<br></p><p>0<br></p><p>1</p><p>2</p><p>3</p><p>4</p><p>.....</p><p>If I set it as 3, it prints out</p><p>0</p><p>0</p><p>0</p><p>1</p><p>2</p><p>3</p><p>4</p><p>..</p><p><br></p><p>How could I retrieve the correct queue size regardless of the prefetchCount.</p><p><br></p><p>thanks for your concerns.</p></blockquote></div>