camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Claus Ibsen (JIRA)" <>
Subject [jira] [Commented] (CAMEL-4022) Issue using errorBuilderRef with the xml dsl
Date Sun, 05 Jun 2011 15:41:47 GMT


Claus Ibsen commented on CAMEL-4022:

Okay Hadrian is correct when he suggests a OnExceptionErrorHandler (he named it FatalErrorHandler)
that is stateless and doesn't do redelivery and whatnot. I got a prototype up and running
with that now.

So what we need to consider is what the outcome of the processing of the Exchange should be
when using OnException and a 2nd exception is thrown from within OnException. I hope you follow
me now.

As I see we can do either of the following
a) log the 2nd exception and then ignore it
b) log the 2nd exception and set it as exception on the Exchange
c) as b + force the exchange to fail, even if continued/handled was set to true
d) as b + having an option to control if we should force the exchange to fail or not

And in terms of logging, we can have log level options end users can control in  case they
don't want that. But by default I suggest its logged at WARN level incl. stacktraces

The "big" questions is what we should consider as the outcome. Should the 2nd exception be
ignored or not. And if not ignored should it replace the 1st exception on the Exchange. And
if so should we always force the Exchange to fail, even if the end user configured handled(true)

> Issue using errorBuilderRef with the xml dsl
> --------------------------------------------
>                 Key: CAMEL-4022
>                 URL:
>             Project: Camel
>          Issue Type: Bug
>    Affects Versions: 2.7.1
>            Reporter: Hadrian Zbarcea
>            Assignee: Hadrian Zbarcea
>            Priority: Critical
> While fixing issues around the errorHandler I noticed that <onException> definitions
defined in the camel context are ignored if a route specifies its own errorHandlerRef. The
reason is that we set the onException definition on the default error handler. I have a fix
for that, but I discovered a different issue (I think) for which I would like to discuss the
> When we have an onException definition that looks kinda like this:
> {code}
> <onException>
>   <exception> java.lang.IllegalArgumentException</exception>
>   <to uri="mock:illegalArgumentException"/>
> </onException>
> {code}
> ... something happens, the IAE exception is caught, we do something, but in that process
another exception is thrown. Currently, that would be caught by the default error handler,
which may not be what we want.
> What error handler (if any) should handle exceptions thrown while in onException?
> The onException mechanism is somewhat similar to a try/catch. I don't think the exceptions
thrown while handling onException should be handled by the same error handler configured for
the route, or even the context scoped one. The processing should be very simple, predictable
and immutable. Since the default "CamelDefaultErrorHandlerBuilder" can be replaced, it is
not imho a solution and we need one global one that does as little as possible (the problem
would be agreeing what that is: no redeliveries, logging or not, etc).
> Thoughts?

This message is automatically generated by JIRA.
For more information on JIRA, see:

View raw message