camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <>
Subject Re: onException is ignored
Date Sat, 10 Jan 2015 07:21:56 GMT
Since you use transactions then sending a message to a JMS queue is
also rolled back, and hence the onException "appears" to not send the
message to the account not found queue. But its because the tx is
rolled back.

You can define a 2nd jms component, eg using a different name than
jms, that does not become part of the same tx, and use that in the

On Fri, Jan 9, 2015 at 6:38 PM, James Green <> wrote:
> Project is Spring based with Camel 2.14 and the following configuration:
>         onException(AccountNotFoundException.class)
>                 .log("Account Not Found. Message
> discarded.").to("jms:queue:RouterAccountNotFound").stop();
>         errorHandler(transactionErrorHandler().maximumRedeliveries(3));
>         from(source())
>                 .transacted()
>                 .unmarshal(jacksonUnmarshall)
>                 .process(router)
>                 .recipientList(simple("${}"));
> We have a JMS connection and a JPA connection wrapped in a Atomikos
> transaction manager (a XA transaction manager I understand to be required).
> The above errorHandler triggers if the router throws an Exception, but the
> onException statement does not fire despite the logs recording the
> AccountNotFoundException being caught by Camel.
> Consequently the log()ing and the RouterAccountNotFound queue do not fire
> at all.
> The documentation suggests onException should be usable at this point. Can
> anyone suggest why the above only partly works?
> Thanks,
> James

Claus Ibsen
Red Hat, Inc.
Twitter: davsclaus
Author of Camel in Action:

View raw message