You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by "Martin C." <ma...@gmx.at> on 2011/07/05 16:49:25 UTC

Difference between prefetch=0 and prefetch=1?

Hi,

When reviewing ActiveMQ code, I see a lot of special treatment for the
prefetch=0 case. What exactly is the conceptual difference between 1
and 0 prefetch?

We are currently using prefetch=0 via failover, but are in the process
of migrating away from failover to multiple connections with Spring
DefaultMessageListenerContainer, which won't stop on container
shutdown, as the message is stopped before the MessageDispatch from
the broker is returned (i.e. there is the special case that the
MessageConsumer waits indefinitely for a MessagePull from the server
on prefetch=0).

So what exactly do I have to expect as difference in regards to
message ordering, load balancing, message groups when using prefetch=1
instead of prefetch=0?

Thanks for any explanation!

Best regards,
Martin

Re: Difference between prefetch=0 and prefetch=1?

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi Martin,

the only thing is that prefetch=0 will not work with async listeners
(nothing will be pushed to the consumer), but the consumer needs to call
receive() method explicitly (pull the message).

Regards
-- 
Dejan Bosanac - http://twitter.com/dejanb
-----------------
The experts in open source integration and messaging - http://fusesource.com
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Tue, Jul 5, 2011 at 4:49 PM, Martin C. <ma...@gmx.at> wrote:

> Hi,
>
> When reviewing ActiveMQ code, I see a lot of special treatment for the
> prefetch=0 case. What exactly is the conceptual difference between 1
> and 0 prefetch?
>
> We are currently using prefetch=0 via failover, but are in the process
> of migrating away from failover to multiple connections with Spring
> DefaultMessageListenerContainer, which won't stop on container
> shutdown, as the message is stopped before the MessageDispatch from
> the broker is returned (i.e. there is the special case that the
> MessageConsumer waits indefinitely for a MessagePull from the server
> on prefetch=0).
>
> So what exactly do I have to expect as difference in regards to
> message ordering, load balancing, message groups when using prefetch=1
> instead of prefetch=0?
>
> Thanks for any explanation!
>
> Best regards,
> Martin
>