You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Sebastian Czort <sc...@gmail.com> on 2019/06/19 14:17:09 UTC
Error handling across Camel route builders
Hi,
I have a question about best practices on error handling in Camel route A,
which calls Camel route B.
A and B are different route builder instances
class A extends RouteBuilder {
configure() {
onException(Exception.class)
.handled(true)
// produce general error message
from("direct:a")
.. // some processing, which could throw an exception
to("direct:b")
.. // processing after b
}
}
class B extends RouteBuilder {
configure() {
onException(AuthenticationException.class)
.onRedelivery( /** login */);
from("direct:b")
// some processing, which could throw an exception
// some processing, which could throw an authentication exception
}
}
Is there a best practice on how to set this up in Camel, so that general
error messages are produced in A for non-authentication exceptions thrown
in routes A or B?
Please note that I would like to have no processing done in route A after
the call to route B, if the call to route B throws an exception.
Thank you in advance!
Sebastian Czort