apache camel - onException and onCompletion together in RouteBuilder`s route -
i use onexception & oncomplition in 1 route (camel version 2.10.0.redhat-60024):
from("direct:cameltestendpoint"). oncompletion(). log("oncompletion1"). log("oncompletion2"). log("oncompletion3"). end(). onexception(throwable.class). handled(true). log("onexception"). end(). log("route") .throwexception(new runtimeexception());
although not work expect. exception in main route causes oncomplition route stop after first processor (it handled in pipelinehelper`s continueprocessing() method). camel checks if exception handled , if yes - stops processing.
output:
route onexception oncompletion1
is there gentle way camel should skip (without "camelerrorhandlerhandled" property removal)?
thanks
this bug in version of camel.
this has been fixed camel-7707.
as workaround need manually remove details exchange, in first process in oncompletion do.
for example like
// must remember properties cannot use during oncompletion processing // otherwise may cause issues object stop = exchange.removeproperty(exchange.route_stop); object failurehandled = exchange.removeproperty(exchange.failure_handled); object caught = exchange.removeproperty(exchange.exception_caught); object errorhandlerhandled = exchange.removeproperty(exchange.errorhandler_handled);
Comments
Post a Comment