activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Black <>
Subject Client has different prefetch value from Broker, messages never consumed
Date Wed, 12 Oct 2011 08:22:46 GMT
Ok so we are trying to configure a prefetch of 0 on a few of our queues as it
makes no sense for these to use prefetch.  The default should still remain

We have set the destinationPolicy for these queues with a wildcard:

        <policyEntry topic=">" producerFlowControl="true" memoryLimit="7mb">
        <policyEntry queue=">" producerFlowControl="true" memoryLimit="7mb">
        <policyEntry queue="test.queue.>" producerFlowControl="true"
memoryLimit="7mb" queuePrefetch="0">

Now when I connect to one of these queues to consume, I am using:

+ A CachingConnectionFactory with session and consumer caching on.
+ Using Spring jmsTemplate due to a situation where I cannot use Spring DMLC
(yes I cannot use it because I need to throttle the message rate so do not
suggest that please!)

I see no messages getting consumed from the queue at all.

Using JMX I can see that the broker reports the subscription to that queue
has its prefetch set to 0.

I did some debugging and found that on the client side, the
ActiveMQMessageConsumer thinks that the prefetch is 1000.  There is no
specific config on the client side for setting prefetch values.

This means that when ActiveMQMessageConsumer.receive() gets called:

1.  the 3rd method call is to sendPullCommand(0)
2.  If the prefetch was 0 for the client it would send an async request for
a message.  But because the client thinks the prefetch is 1000, this never
gets called and I assuming the Broker never pushes any messages to the
client because it thinks that the prefetch is 0.

Therefore, we just block forever with no hope of ever receiving a message.

Is this a bug?  Or am I configuring something incorrectly.  Personally I do
not see why it should be possible to change the config on the client and
break the operation of ActiveMQ.

I would of thought the prefetch would be negotiated at some stage between
the broker and the consumer.

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

View raw message