prefetch Values

The following table lists values used with the prefetch property.

Value Description
2 or more The message consumer automatically fetches messages from the server. The message consumer never fetches more than the number of messages specified by value.

See Automatic Fetch Enabled for details.

1 The message consumer automatically fetches messages from the server—initiating fetch only when it does not currently hold a message.
none Disables automatic fetch. That is, the message consumer initiates fetch only when the client calls receive—either an explicit synchronous call, or an implicit call (in an asynchronous consumer).

This value cannot be used with topics or global queues.

See Automatic Fetch Disabled for details.

0 The destination inherits the prefetch value from a parent destination with a matching name. If it has no parent, or no destination in the parent chain sets a value for prefetch, then the default value is 5 queues and 64 for topics.

When a destination does not set any value for prefetch, then the default value is 0 (zero; that is, inherit the prefetch value).

See Inheritance for details.

Note: If both prefetch and maxRedelivery are set to a non-zero value, then there is a potential to lose prefetched messages if one of the messages exceeds the maxRedelivery limit. For example, prefetch=5 and maxRedelivery=4. The first message is redelivered 4 times, hits the maxRedelivery limit and is sent to the undelivered queue (as expected). However, the other 4 pre-fetched messages are also sent to the undelivered queue and are not processed by the receiving application. The work around is to set prefetch=none, but this can have performance implications on large volume interfaces.