camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: Catch and handle errors when using the TransactionErrorHandler
Date Fri, 06 Mar 2009 16:10:38 GMT
On Fri, Mar 6, 2009 at 1:51 PM, Henric Hedin <> wrote:
> Hi,
> Is it possible to in some way to use the TransactionErrorHandler and at the
> same time catch and handle exceptions?
> I have read the documentation under
> that for transactional
> exchanges the Error Handler does not kick, so the following code in my Route
> configure will not work:
> errorHandler(bean(TransactionErrorHandlerBuilder.class,
> "transactionErrorHandler"));
> onException(SAXParseException.class).
> handled(true).
> policy(notsupported).
> maximumRedeliveries(1).
> transform().constant("Sorry, parse exception...").
> to("jms:queue:validationFailed.SAXParseException");
> from("jms:queue:input-queue?transacted=true").
> unmarshal(jaxbDataFormat).
> to("jms:queue:output-queue").
> What I'm trying to accomplish is if a parsing exception occurs, I would like
> my incoming message to be rolled back and put on the jms deadletter queue
> (configured for the queue on the JMS provider, when the JMSXDeliveryCount
> has reached it's threshold). But I would also be able to send an information
> jms-message to the same jms-provider with information about why the message
> has been backed out (of course outside the "incoming transaction").
> Maybe a strange solution, but is it possible to handle in Camel? :)
> /Henric
No the DeadLetterChannel is disabled for transacted exchanges. There
is a trick though, if you dont add the Spring Policy then it will
default to REQUIRED and still use DLC.

We are considering how we can provide options for end users in the
future so you can use DLC for somerthing combined with transacted

The problem with transacted exchanges is that they are redelivered in
a totally new thread so Camel has no wait of correlating a previous
attempt, we can only rely on the few JMS options you get such as the
JMSX counter. But we dont know when we have reached exhausted, to send
the extra JMS message

But any feedback and ideas is welcome what we can do in the future to
bring more value to error handling with TX

Claus Ibsen
Apache Camel Committer

Open Source Integration:

View raw message