activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bonnyr <>
Subject How to: Slow consumers and CLIENT_ACKNOWLEDGE?
Date Wed, 09 Jul 2008 07:46:36 GMT


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
   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.


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

View raw message