Hello community I use camel version 3.7.0 in my project.
I just noticed something very interesting while playing around with Multicast (with an aggregation strategy to merge back) CASE 1: When a path which encountered an exception merges *FIRST* JAVA - DSL: public class MulticastTestRoute extends RouteBuilder { @Autowired SimpleFlowMergeAggregator simpleFlowMergeAggregator; @Override public void configure() throws Exception { onException(Exception.class) .useOriginalMessage() .handled(true) .log("Exception handler invoked") .transform().constant("{\"data\" : \"err\"}") .end(); from("jetty:http://localhost:8081/mysql?httpMethodRestrict=GET") .log("received request") /*.process(new Processor() { @Override public void process(Exchange exchange) throws Exception { System.out.println(FlowManagerUtils.dumpCamelRouteDefinition(exchange.getContext())); } })*/ .multicast(simpleFlowMergeAggregator) .parallelProcessing().to("direct:A", "direct:B") .end() .log("Aggregated results ${body}") .log("Another log") .end(); from("direct:A") .log("Executing PATH_1 - exception path") .transform(constant("DATA_FROM_PATH_1")) .throwException(new Exception("USER INITIATED EXCEPTION")) // simulating exception scenario here .log("PATH_1") //.delayer(100) .end(); from("direct:B") .log("Executing PATH_2 - success path") .delayer(100) .transform(constant("DATA_FROM_PATH_2")) .log("PATH_2") .end(); } } LOG: 18:04:20.596 [qtp1886136102-138] INFO route3 - received request18:04:20.604 [Camel (camel-1) thread #7 - Multicast] INFO route4 - Executing PATH_1 - exception path18:04:20.609 [Camel (camel-1) thread #7 - Multicast] INFO route4 - Exception handler invoked18:04:20.610 [Camel (camel-1) thread #7 - Multicast] INFO com.huawei.camel.core.route.SimpleFlowMergeAggregator - Inside aggregator {"data" : "err"}18:04:20.704 [Camel (camel-1) thread #6 - Multicast] INFO route5 - Executing PATH_2 - success path18:04:20.905 [Camel (camel-1) thread #6 - Multicast] INFO route5 - PATH_2 18:04:20.905 [Camel (camel-1) thread #6 - Multicast] INFO com.huawei.camel.core.route.SimpleFlowMergeAggregator - Inside aggregator DATA_FROM_PATH_2 CASE 2: When a path which encountered an exception merges *LATER* JAVA-DSL: public class MulticastTestRoute extends RouteBuilder { @Autowired SimpleFlowMergeAggregator simpleFlowMergeAggregator; @Override public void configure() throws Exception { onException(Exception.class) .useOriginalMessage() .handled(true) .log("Exception handler invoked") .transform().constant("{\"data\" : \"err\"}") .end(); from("jetty:http://localhost:8081/mysql?httpMethodRestrict=GET") .log("received request") /*.process(new Processor() { @Override public void process(Exchange exchange) throws Exception { System.out.println(FlowManagerUtils.dumpCamelRouteDefinition(exchange.getContext())); } })*/ .multicast(simpleFlowMergeAggregator) .parallelProcessing().to("direct:A", "direct:B") .end() .log("Aggregated results ${body}") .log("Another log") .end(); from("direct:A") .log("Executing PATH_1 - exception path") .transform(constant("DATA_FROM_PATH_1")) .throwException(new Exception("USER INITIATED EXCEPTION")) // simulating exception scenario here .log("PATH_1") .delayer(100) .end(); from("direct:B") .log("Executing PATH_2 - success path") //.delayer(100) .transform(constant("DATA_FROM_PATH_2")) .log("PATH_2") .end(); }} LOG: 18:08:14.136 [qtp2070645994-143] INFO route3 - received request18:08:14.146 [Camel (camel-1) thread #6 - Multicast] INFO route5 - Executing PATH_2 - success path18:08:14.147 [Camel (camel-1) thread #6 - Multicast] INFO route5 - PATH_218:08:14.147 [Camel (camel-1) thread #6 - Multicast] INFO com.huawei.camel.core.route.SimpleFlowMergeAggregator - Inside aggregator DATA_FROM_PATH_218:08:14.246 [Camel (camel-1) thread #7 - Multicast] INFO route4 - Executing PATH_1 - exception path18:08:14.551 [Camel (camel-1) thread #7 - Multicast] INFO route4 - Exception handler invoked18:08:14.652 [Camel (camel-1) thread #7 - Multicast] INFO com.huawei.camel.core.route.SimpleFlowMergeAggregator - Inside aggregator {"data" : "err"}18:08:14.653 [Camel (camel-1) thread #7 - Multicast] INFO route3 - Aggregated results DATA_FROM_PATH_2,{"data" : "err"}18:08:14.653 [Camel (camel-1) thread #7 - Multicast] INFO route3 - Another log My Observations : When the path which encountered an exception merges first in the aggregator, for some reason the remaining part of the flow doesn't get executed. On the other hand, if a path which encountered an exception comes later, it still continues to route the remaining part of the flow. You can see I simulate both scenarios using a delayer eip. When i say "remaining part of the flow", I refer to the remaining loggers => *.log("Aggregated results ${body}").log("Another log")* Is this some sort of BUG in the framework or is it there for a reason? Cheers Reji Mathews