Reputation: 503
In RabbitMQ tutorial, there is such code:
channel.BasicQos(prefetchSize: 0, prefetchCount: 1, global: false);
I understand what's prefetchCount
and global
, but not prefetchSize
.
Does anyone know?
Upvotes: 15
Views: 8635
Reputation: 2868
prefetchSize
: maximum amount of content (measured in
octets) that the server will deliver, 0 if unlimited.
prefetchCount
: maximum number of messages that the server will deliver, 0 if unlimited.
count
means you set the limit based on the numbers of messages while size
means set the limit based on the actual message content size.
Upvotes: 2
Reputation: 151
I found this in the protocol reference https://www.rabbitmq.com/amqp-0-9-1-reference.html (emphasis mine):
long prefetch-size
The client can request that messages be sent in advance so that when the client finishes processing a message, the following message is already held locally, rather than needing to be sent down the channel. Prefetching gives a performance improvement. This field specifies the prefetch window size in octets. The server will send a message in advance if it is equal to or smaller in size than the available prefetch size (and also falls into other prefetch limits). May be set to zero, meaning "no specific limit", although other prefetch limits may still apply. The prefetch-size is ignored if the no-ack option is set.
The server MUST ignore this setting when the client is not processing any messages - i.e. the prefetch size does not limit the transfer of single messages to a client, only the sending in advance of more messages while the client still has one or more unacknowledged messages.
Upvotes: 15