When you use Java DSL, then use Java inheritance to have global scoped error handling.
Create a base class that is a RouteBuilder, and do your global scoped error handling etc, in the configure method. And then invoke a abstract method, that your other routes extend and do their routing inside. On Wed, Jul 11, 2012 at 5:40 PM, Hilde <hilde.sch...@yahoo.de> wrote: > Hello! > > We design different camel routes in different RouteBuilder classes and the > one is > calling the other one: > > RouteBuilder No. 1 > > @Override > public void configure() throws Exception { > from("activemq:" + JmsDestinations.QUEUE_INIT_MAIN_ROUTE) > .routeId("initMainRoute") > .onException(Exception.class) > .handled(true) > .to("activemq:topic:" + > JmsDestinations.TOPIC_LOG_SERVICE) > .end() > .to("direct:emptyDirectoryRoute") > .setHeader("SUCCESS_INIT", > header(EmptyDirectoryDataReceived.IS_DIRECTORY_CLEANSED)); > } > > > RouteBuilder No. 2 > > @Override > public void configure() throws Exception { > from("direct:emptyDirectoryRoute").routeId("emptyDirectoryRoute") > .onException(Exception.class) > .end() > .bean(EmptyDirectoryDataReceived.class) > .setBody(simple("${header." + > DN1CamelHeader.PROTOCOL_DIRECTORY_CLEANING > + "}")); > } > > How can we reach that the exception handling in route No. 1 catches and > handles all exceptions that are thrown in route No. 2? > Global scoped exception handling seems not an alternative because we have > many routes and exceptions should be handled individually. > > Many thanks > Hilde > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Exception-handling-within-route-chains-tp5715862.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen ----------------- FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen