You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Jim Alateras <ji...@comware.com.au> on 2007/07/10 15:12:24 UTC

Creating MessageConsumer overhead

Just a general question about the overhead on creating MessageConsumer 
instances. Is it efficient to create MessageConsumers for relatively 
short conversations.

For example a loop which basically checks for a message, executes a 
policy on the message and then sleeps for some interval. Would it be 
efficient to create a new MessageConsumer at the start of each iteration.

cheers
</jima>

Re: Creating MessageConsumer overhead

Posted by James Strachan <ja...@gmail.com>.
On 7/10/07, Jim Alateras <ji...@comware.com.au> wrote:
> Just a general question about the overhead on creating MessageConsumer
> instances. Is it efficient to create MessageConsumers for relatively
> short conversations.
>
> For example a loop which basically checks for a message, executes a
> policy on the message and then sleeps for some interval. Would it be
> efficient to create a new MessageConsumer at the start of each iteration.

Its mostly a latency cost on the client side. There's some overhead;
particularly if the consumer is on a large queue using selectors with
filter most messages; as each new consumer created causes the broker
to iterate through all pending messages attempting to push them to the
new consumer.

So the faster approach will always to be to create consumers up front
and share them- then use say Message Groups to keep conversations
apart - but otherwise creating consumers for relatively short
conversations should be fine.


-- 
James
-------
http://macstrac.blogspot.com/