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

Reply via email to