You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by bonnyr <bo...@optusnet.com.au> on 2008/07/09 09:46:36 UTC

How to: Slow consumers and CLIENT_ACKNOWLEDGE?

All,

We're using AMQ as follows:
A producer is connected to it's own (almost embedded) broker to deliver
messages reliably (using
kaha persistence)
A consumer is connected to the broker and sets the ack mode to
CLIENT_ACKNOLEDGMENT. The 
   consumer is itself multi threaded and the thread that processes the
messages is not the same 
   thread the consumes them. The processing thread has an internal work
queue that is used
   for the consumed messages as well as periodic tasks. The processing
thread acknowledges
   messages as it finishes processing them (in batches).

While the consumer is going through fast enough to consume and process the
messages, the ack
mode makes no difference. However, if there's a backlog for whatever reason,
and the consumer 
is disconnected from the queue for whatever reason (network disruption or
other reasons), then 
upon reconnecting to the broker, all messages that were delivered to the
consuming thread above,
but not yet processed, are lost to the consumer, as the ack operations while
the consumer is running
acknowledges ALL messages delivered to that point to the consumer.

So, my question is: what's the best practice for achieving this goal? Is
there a way to control the 
acknowledgement so it pertains to the messages rather than the session? Is
the only way to achieve
this to block the consuming thread and not let any more messages be consumed
whilst the processing
thread is busy processing the current batch of messages?

Any help would be appreciated.

Cheers,

Bonny
-- 
View this message in context: http://www.nabble.com/How-to%3A-Slow-consumers-and-CLIENT_ACKNOWLEDGE--tp18356204p18356204.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: bump

Posted by Rob Davies <ra...@gmail.com>.
On 10 Jul 2008, at 12:30, bonnyr wrote:

>
>
> bump
> --  
> View this message in context: http://www.nabble.com/How-to%3A-Slow-consumers-and-CLIENT_ACKNOWLEDGE--tp18356204p18380884.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

I hate answering questions - with use the latest snapshot - but ...
For 5.2 there is the option of a new acknowledgement mode on a Session  
ActiveMQSession.INDIVIDUAL_ACKNOWLEDGE - which allow you to  
acknowledge messages individually, instead of all the messages  
consumed to that point in the session

cheers,

Rob




Rob Davies
'Go further faster with Apache Camel!'
http://rajdavies.blogspot.com/




bump

Posted by bonnyr <bo...@optusnet.com.au>.

bump
-- 
View this message in context: http://www.nabble.com/How-to%3A-Slow-consumers-and-CLIENT_ACKNOWLEDGE--tp18356204p18380884.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.