With camel 2.8.1 I get the following behavior: I have a setup with an outer route and an inner. The error handling is defined in the outer route, the inner route has error handling disabled by setting noErrorHandler(). Now the error handler of the outer route is called if an exception occurs on the inner route, but NOT if the error occurs within a split block. Here is a unit test showing this behavior:
package test; import org.apache.camel.CamelContext; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.DefaultCamelContext; import org.junit.Before; import org.junit.Test; public class ErrorHandlingTest { private CamelContext context; private ProducerTemplate producer; @Before public void setup() throws Exception { context = new DefaultCamelContext(); context.addRoutes(new TestRoute()); producer = context.createProducerTemplate(); context.start(); } /* * Test works as expected, exception is thrown in 'main' route */ @Test public void test() throws Exception { context.addRoutes(new TestRouteInner()); producer.sendBody("direct://testError", new String[] { "m1", "m2" }); } /* * The only difference to other test is that exception is thrown within split block */ @Test public void testWithSplit() throws Exception { context.addRoutes(new TestRouteInnerWithSplit()); producer.sendBody("direct://testError", new String[] { "m1", "m2" }); } private static final class TestRoute extends RouteBuilder { public void configure() { onException(Throwable.class) .logStackTrace(false) .handled(true); from("direct://testError") .to("direct://testErrorInner"); } } private static final class TestRouteInner extends RouteBuilder { public void configure() { from("direct://testErrorInner") .errorHandler(noErrorHandler()) .throwException(new RuntimeException("Forced Runtime Exception")); } }; private static final class TestRouteInnerWithSplit extends RouteBuilder { public void configure() { from("direct://testErrorInner") .errorHandler(noErrorHandler()) .split(body()).stopOnException().shareUnitOfWork() .throwException( new Exception("Forced SPLITTER Runtime Exception")) .end(); } }; } -- View this message in context: http://camel.465427.n5.nabble.com/ErrorHandling-with-Subroutes-and-Splitters-tp5682750.html Sent from the Camel - Users mailing list archive at Nabble.com.