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
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.