additionally, this is an initialization code for channels.<div><br></div><div>







<p class="p1">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span class="s1">channel</span> = ConnectionManager.createChannel();</p>
<p class="p2">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</p>
<p class="p3"><span class="s2">&nbsp; &nbsp; &nbsp; &nbsp; </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">&nbsp; &nbsp; &nbsp; &nbsp; <span class="s1">channel</span>.basicQos(<span class="s1">prefetchCount</span>);</p>
<p class="p2"><br></p>
<p class="p1">&nbsp; &nbsp; &nbsp; &nbsp; <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">&nbsp; &nbsp; &nbsp; &nbsp; </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">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;</p>
<p class="p3"><span class="s2">&nbsp; &nbsp; &nbsp; &nbsp; </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,&nbsp;</p><p>I am a newbie to use a rabbitmq.&nbsp;</p><p>currently, I am using it without no auto-ack mode.&nbsp;</p><p>manually, I send &nbsp;ack/nack after receiving messages from queues.</p><p>but, on this, I found that&nbsp;current queue size is always different with a real queue size. actually, it is always same with actual queue size - prefetch size.&nbsp;</p><p>here is my code to send.&nbsp;</p><p>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span>channel</span>.basicPublish(<span>exchang<wbr>eName</span>, <span>queueName</span>, <span><b>null</b></span>, message);</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; 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&nbsp;</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>