[rabbitmq-discuss] does client caches messages?

Matthias Radestock matthias at rabbitmq.com
Sat May 11 14:51:23 BST 2013


On 11/05/13 12:42, Mohsen Lotfizad wrote:
>          channel.basicConsume(QUEUE_NAME, false, consumer);
>          channel.basicQos(1);

There's your problem.

As soon as the consumer is created, RabbitMQ will start delivering 
messages to it. By the time the prefetch is set, many messages may 
already be on their way to the client.

You should set the prefetch *before* consuming.

Matthias.


More information about the rabbitmq-discuss mailing list