<div dir="ltr">I download the <a href="http://github.com/rabbitmq/rabbitmq-tutorials/blob/master/java/Recv.java" style="color:rgb(255,153,51);text-decoration:underline;font-weight:bold;font-family:Verdana,sans-serif;font-size:12.800000190734863px;font-style:normal;font-variant:normal;letter-spacing:normal;line-height:18px;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255)"><span class="code " style="color:rgb(51,51,51);font-family:&#39;Courier New&#39;,Courier,monospace;font-size:small;white-space:nowrap">Recv.java</span></a><span style="color:rgb(85,85,85);font-family:Verdana,sans-serif;font-size:12.800000190734863px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:18px;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);display:inline!important;float:none"></span><span style="color:rgb(85,85,85);font-family:Verdana,sans-serif;font-size:12.800000190734863px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;line-height:18px;text-align:left;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);display:inline!important;float:none"></span>  and change some of its code to this:<br>

<br><i>        ConnectionFactory factory = new ConnectionFactory();<br>         //factory.setHost(&quot;localhost&quot;);<br>        factory.setUri(&quot;amqp://<a href="http://guest:guest@127.0.0.1:5672">guest:guest@127.0.0.1:5672</a>&quot;);<br>

        Connection connection = factory.newConnection();<br>        Channel channel = connection.createChannel();<br><br>        channel.queueDeclarePassive(QUEUE_NAME);<br>        System.out.println(&quot; [*] Waiting for messages. To exit press CTRL+C&quot;);<br>

<br>        QueueingConsumer consumer = new QueueingConsumer(channel);<br>        channel.basicConsume(QUEUE_NAME, false, consumer);<br>        channel.basicQos(1);<br><br></i><i><br></i><br><br><div class="gmail_quote">
On Sat, May 11, 2013 at 12:14 PM, Matthias Radestock <span dir="ltr">&lt;<a href="mailto:matthias@rabbitmq.com" target="_blank">matthias@rabbitmq.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 11/05/13 08:36, Mohsen Lotfizad wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
In fact I just want to know when I set prefetch_cont=2, why my consumer<br>
try to give about 700 messages?<br>
</blockquote>
<br></div>
How is your consumer consuming messages? With basic.consume or basic.get? Prefetch does not apply to the latter since the client is explicitly asking for the next message.<span class="HOEnZb"><font color="#888888"><br>
<br>
Matthias.<br>
</font></span></blockquote></div><br></div>