camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: onException is ignored
Date Mon, 12 Jan 2015 10:10:33 GMT
Hi

No the onException should be triggered even for TX.

You may try to configure onException after errorHandler.


On Mon, Jan 12, 2015 at 11:02 AM, James Green <james.mk.green@gmail.com> wrote:
> So when using onException it's really important not to use a component that
> is already partaking in the transaction being rolled back? I get that now,
> but it's not immediately obvious.
>
> Does this explain why the log()ged message, "Account Not Found. Message
> discarded." does not appear in the console though?
>
> On 10 January 2015 at 07:23, Willem Jiang <willem.jiang@gmail.com> wrote:
>
>> If the Exception is thrown from the source() endpoint, the onException
>> error handler won’t work as you expected.
>>
>> --
>> Willem Jiang
>>
>> Red Hat, Inc.
>> Web: http://www.redhat.com
>> Blog: http://willemjiang.blogspot.com (English)
>> http://jnn.iteye.com (Chinese)
>> Twitter: willemjiang
>> Weibo: 姜宁willem
>>
>>
>>
>> On January 10, 2015 at 1:38:52 AM, James Green (james.mk.green@gmail.com)
>> 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("${body.media}"));
>> >
>> > 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.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message