Reputation: 683
There is a camel route, which is transacted and exceptions are handled by a TransactionErrorHandler
. The code looks something like this:
...
<bean
id="errorHandler"
class="org.apache.camel.spring.spi.TransactionErrorHandlerBuilder">
</bean>
...
<camelContext errorHandlerRef="errorHandler">
...
<onException>
<exception>java.lang.Exception</exception>
<handled>
<constant>true</constant>
</handled>
<!-- do some exception handling -->
</onException>
<route>
<from uri="mq:queue://QMgr/Q?exchangePattern=InOut" />
<transacted />
<!-- some routing that throws an Exception -->
</route>
</camelContext>
It works and there is a commit for the transaction after the error has been handled: Transaction commit (0xfab75a3a) redelivered(true) for ...
, but then the message is placed in the input queue again and the transaction starts from the beginning (endless loop).
We are using IBM MQ and I think this rollback is performed by MQ and not from the camel route. So the question is: Can I tell MQ that I handled the exception and that it should not rollback again?
Upvotes: 1
Views: 1059
Reputation: 4306
IBM MQ is resending the message to the consumer by design. To have the broker stop after X number of tries, configure a 'backout threshold' and a 'blackout queue' for IBM MQ to move the messages out of the way after failed delivery attempts.
Upvotes: 1