Camel route that rolls back local JMS transaction, augments messages with exception details and forwards message to another queue

Solution Unverified - Updated -


By default a camel route marked as "transacted()" will use the TransactionErrorHandler. When an exception occurs the TransactionErrorHandler causes the transaction to be rolled back. The message is again available on the original queue to be consumed by the route. By default Activemq will redeliver the message 6 times to a consumer (in this case the camel route) and then move the message to the Dead Letter Queue .
A consequence to using transaction; any message sent to activemq with the context of the transaction will also be rolled back .

from("activemq:queue:a") .transacted("PROPAGATION_REQUIRED") .to("activemq:queue:b") .process(myprocessor) //<-- throws exception for test purposes .to("activemq:queue:c");

In the above example when the transaction is rolled back the message sent to "queue b" is also rolled back.
How do I rollback the transaction but still capture the exception/original message and forward to another queue?


  • Red Hat JBoss A-MQ
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content