Consultor Eletrônico



Kbase 19933: SonicMQ: How to Disable Message Prefetch
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   25/06/2001
SUMMARY:

This solution applies to SonicMQ Versions 2000.x and 3.x, and is
specific to the Point-to-Point messaging domain. It explains why a
QueueReceiver may pull more than one message from a Queue at a time,
and how to modify this behavior.


EXPLANATION:

The prefetch count determines the number of messages requested in a
single fetch request sent to a broker. Setting the prefetch count to
zero is not allowed because the QueueReceiver would never receive any
messages. The default value for prefetch count is 3.

The prefetch threshold determines when messages are fetched, and if
any are "pre"fetched at all. When the number of messages in the
receiver's local buffer drops to or below the prefetch threshold, the
QueueReceiver prefetches from the Queue the number of messages
specified by the prefetch count. The default value for prefetch
threshold is 1.


SOLUTION:

To disable the message prefetch, set the QueueReceiver's prefetch
count to 1 and its prefetch threshold to 0 with the method calls
QueueReceiver.setPrefetchCount(1) and
QueueReceiver.setPrefetchThreshold(0). Now the client pulls messages
one at a time from the Queue in response to each request.


References To Written Documentation:

SonicMQ Programming Guide, Chapter 6, "Point-to-Point Messaging"

Sonic Knowledge Base Solution 20172:
Why isn't my PREFETCH_COUNT Used on the First PREFETCH?