You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Quinn Stevenson <qu...@pronoia-solutions.com> on 2017/12/20 20:08:51 UTC

Re: JMS Acknowledge mode

I’m not sure I’m following you, but I can tell you what I normally do.

My JMS Consumers use “transacted=true”, which will use a JMS Session transaction.  You don’t need the acknowledgementModeName, and I don’t think you need ‘.transacted()’ (I believe this is for XA).

I then setup exception policies for the different types of exceptions, with appropriate redelivery handling.

For the case where I don’t have an exception policy for an exception, Camel will rollback the message.  I also use ActiveMQ, so the message will get moved to a DLQ after being rolled-back 6 times.

HTH

Quinn Stevenson
quinn@pronoia-solutions.com
(801) 244-7758



> On Sep 4, 2017, at 5:21 AM, Andreas Bergmann <be...@gmail.com> wrote:
> 
> Hi all,
> 
> I have the scenario where I need to manipulate the acknowledgement of JMS
> messages, depending on exceptions.
> 
> The setup so far:
> I configured the JMS endpoint with
> '&transacted=true&acknowledgementModeName=SESSION_TRANSACTED' and I
> added .transacted() to the route definition.
> 
> As soon as I have an Exception the messages will not be acknowledged and
> 'redelivered' from the JMS - so far so good.
> 
> But I have several steps in the route, some of them have recoverable, some
> unrecoverable reasons.
> I first parse the incoming message and in case of an exception I do not
> want the JMS to be acknowledged, since this is an unrecoverable error.
> Then I consume the message, which includes a validation and an own 'retry
> handling' in case of an exception - in this case the JMS message should be
> acknowledged.
> In case of other Exceptions (i.e. na db connection) I do not want the
> message to be acknowledged.
> 
> I tried several options with 'doCatch', 'onException', 'setFault in the
> Consumer','.handled(true)', '.stop()'  - but found no way to solve this
> problem. I can either switch to 'always acknowledge in case of an
> exception' or 'never acknowledge on exception'.
> 
> Any ideas or examples?
> 
> Best regards,
> Andreas