[rabbitmq-discuss] the meaning of prefetch ?

Emile Joubert emile at rabbitmq.com
Tue Oct 23 17:44:02 BST 2012


Hi Andy,

On 23/10/12 00:43, D调的#暖冬 wrote:
>  1. In offical website ,it describe that :" it is useful to be able to
> specify how many messages each consumer can be sent at once before
> sending the next acknowledgement" . when we first request the server, we
> can get the amount which  defined by prefetch of messages  into my
> client buffere pool,then my application will process it,if it can be
> successfully processed ,the client need send a ACK back to the server,
> to notice server that the message can be delete.Next,I doubt that
> whether the server will re-send  some new messages to client?  and  the
> amount  equals the  value of the prefetch or not  ?

That is correct. As soon as the client send an ACK to the server, the
server will send more messages. The multiple flag was set then many
messages may be sent (up to prefetch messages). If the multiple flag was
not set then only one message will be sent:
http://www.rabbitmq.com/amqp-0-9-1-reference.html#basic.ack.multiple
If there are no messages in the queue, then the client must wait until
more messages arrive.

> 2.when the prefetch  define  will has  effect on my application?

If your application is driven by a queue subscription then it may well
have an effect.


-Emile



More information about the rabbitmq-discuss mailing list