Hello.  This should be pretty simple, but something is eluding me.  I have
my camel routing exposed via a REST endpoint for use by other services.
When a message is received from the REST endpoint, it is directed to my
Camel content based router where it is dispatched to a sub-route to fulfill
a request.

If an exception occurs in the sub-route, I want to handle it there by
wrapping it in a custom exception, and then I want to propagate it upward
to the route that contains the content based router so that I can take some
action (log it, or send it to an error queue, etc).

Currently, in the sub-route, I have it configured like:

from("vm:start")
    .doTry()
        .process(someCoolProcessor)
        .to(myResultEndpoint)
    .doCatch(Exception.class)
        .process(subRouteErrorProcessor);

When I run my app and cause an exception to be thrown, the error processor
is invoked and it wraps the exception successfully.  But I look in my logs,
and the original exception is logged in the sub-route and also in the route
that contains the content based router.  After that, only then is my
wrapped exception finally reported.

How can I prevent the exceptions from being logged by the sub-route and the
main (content based router) route, and only be logged when I specifically
want to log them?

Reply via email to