AMQP supports prefetch which specifies how many messages the client wishes to cache for delivery. The method Session.setDefaultPrefetch(int) allows a default value to be configured at the session level and extra varients of the createConsumer() method exist allowing it to be specified at the point of consumer construction. It can also be specified as part of the Connection URL. It can be configured with the IMMEDIATE_PREFETCH System property

By default, the number of messages which will be filled by the broker on any particular client is 5000.

It is important to consider the implications of prefetch if you wish to Use Priority Queues.

  • No labels