activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fl <>
Subject PrefetchSize doesn't work.
Date Thu, 03 Jul 2008 16:23:54 GMT


I have trouble with disabling prefetch buffer for consumers. I made simple

This is my configuration (i tried the same with values = 0): 
ConnectionFactory connectionFactory = new
Destination destination = new

There is one producer (Producer) and two consumers (ConsumerA, ConsumerB).
All consumers and producers are connected to the same queue 'destination'.
All consumers and producers are created at begin of the test. So before
Producer send a any message, both consumers are ready for receiving
messages. MessageConsumer#receive() method is used for receiving.

At this point, Producer send 10 messages. Then ConsumerA tries to get as
much messages as possible from queue, and it gets 5 messages. Then ConsumerB
tries to get as much messages as possible from queue, and it gets 5 messages
My question is: why ? :)

I expected that 9 messages will be consumed by ConsumerA and 1 message by
ConsumerB. Instead, its looks like ConsumerB blocks 5 messages for itself,
when it should be able to block only one message (according to
I tried various combination with these three parameters showed above and it
is always the same behavior.

I check 'PrefetchSize' for these subscriptions via JMX console just before
any receiving (so there were 10 messages in queue). 
'PrefetchSize' was set to 1 for both subscriptions. It was strange because
'PendingQueueSize' for these subscriptions was set to 4. It looks like 1
message in prefetch cache and 4 messages in pending queue gives our 5
messages that were blocked by ConsumerB. 

And two additional question:
1) 'PendingQueue' - what it actually is ? 
2) Is there any way to set these parameters in xml configuration file? So
all ConnectionFactory'ies created without explicitly overwriting will use
values from xml.

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message