I seems to face Paolo's issue, on camel v2.12.1 and 2.14.1 and built minimal
harness to demonstrate it.

In this test, the "processItem" sub route handles the hard-coded exception.
When the exchange goes back inside the split of the main route, I would have
expected the .log("${body}") to be invoked, however it doesn't happen - the
aggregation strategy is called directly instead.

Cheers,
Guillaume


        public static void CamelTest() throws Exception
        {
                RouteBuilder builder = new RouteBuilder() 
                {

                        @Override
                        public void configure() throws Exception {
                                from("direct:start").routeId("startRoute")
                            .setHeader("SplitArray", constant(new String [] { 
"split1",
"split2"}))
                            .split(header("SplitArray"), new 
AggregationStrategy(){@Override
public Exchange aggregate(Exchange oldExchange,Exchange newExchange) {return
null;}})
                                .to("direct:processItem")
                                .log("${body}")
                            .end()
                            .log("split end");
                                
                                from("direct:processItem")
                        
.errorHandler(defaultErrorHandler()).onException(Exception.class).handled(true).end()
                                .throwException(new Exception("error!"))
                                //.log("OK")
                                ;                               
                        }
                };
                CamelContext context = new DefaultCamelContext();
                context.addRoutes(builder);
                //context.setTracing(true);
                context.start();
                
                
                
                Endpoint endpoint = context.getEndpoint("direct:start");
                Producer producer = endpoint.createProducer();
                Exchange exchange = producer.createExchange();
                exchange.setIn(new DefaultMessage());
                producer.start();
                producer.process(exchange);
                producer.stop();
                context.stop();
        }



--
View this message in context: 
http://camel.465427.n5.nabble.com/Split-with-Aggregation-when-throw-Exception-issue-tp5750159p5761173.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to