You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by yair <ya...@sundaysky.com> on 2010/03/18 16:49:01 UTC

One transacted consumer prevents other from consuming

Hi all
I have a job's queue, from which a worker receives messages to work on.
Each time the worker decides to take a job (it can handle more than on the
same time) it calls createQueueSession with transacted=true, creates a
consumer, receives a message, and keep these 3 objects until the job's
handling is over.
If, while the job is handled (and the transacted session is still alive),
the worker tries to get another message (by creating a new session and so
on), it doesn't get any messages from the queue even if they are messages
waiting beside the one it already handles. Even if another worker tries, it
gets nothing.
This means that the session and consumer the first worker creates, get some
how a lock on the queue, and no other consumer can get messages from it.

How can I fix this? I need to keep the session transacted because I want the
message to be deleted from the queue only when the worker is done with it.
If the worker crashes, for example, I need the message to return to the
queue so other workers can handle it. This is working well now.

Thanks,
Yair

-- 
View this message in context: http://old.nabble.com/One-transacted-consumer-prevents-other-from-consuming-tp27947475p27947475.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: One transacted consumer prevents other from consuming

Posted by Gary Tully <ga...@gmail.com>.
set the prefetch=3 for your destination. see:
http://activemq.apache.org/what-is-the-prefetch-limit-for.html

On 18 March 2010 15:49, yair <ya...@sundaysky.com> wrote:

>
> Hi all
> I have a job's queue, from which a worker receives messages to work on.
> Each time the worker decides to take a job (it can handle more than on the
> same time) it calls createQueueSession with transacted=true, creates a
> consumer, receives a message, and keep these 3 objects until the job's
> handling is over.
> If, while the job is handled (and the transacted session is still alive),
> the worker tries to get another message (by creating a new session and so
> on), it doesn't get any messages from the queue even if they are messages
> waiting beside the one it already handles. Even if another worker tries, it
> gets nothing.
> This means that the session and consumer the first worker creates, get some
> how a lock on the queue, and no other consumer can get messages from it.
>
> How can I fix this? I need to keep the session transacted because I want
> the
> message to be deleted from the queue only when the worker is done with it.
> If the worker crashes, for example, I need the message to return to the
> queue so other workers can handle it. This is working well now.
>
> Thanks,
> Yair
>
> --
> View this message in context:
> http://old.nabble.com/One-transacted-consumer-prevents-other-from-consuming-tp27947475p27947475.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com