Am just trying to understand the nature of multicast EIP and its further
processing down.

I have a route as follows

@Override
public void configure() throws Exception {
    from("jetty:http://0.0.0.0:8081/testagg?httpMethodRestrict=GET";)
            .convertBodyTo(String.class)
            
.multicast(stringConcatStrategy).parallelProcessing(true).to("direct:a","direct:b")
            .log("MultiCast Completed body = ${body}")
            .setBody(constant("data3"))
            .log("After setting new body => ${body}")
            .transform(constant("data4"))
            .end();

    from("direct:a")
            .transform(simple("data1")) // instead you can have http
client call here
            .delayer(5000)
            .end();

    from("direct:b")
            .transform(simple("data2")) // instead you can have http
client call here
            .end();
}



I poked the flow using an http client and I see the following log
being printed even before the http call returns.

2020-07-03 14:31:40.291  INFO 363488 --- [#10 - Multicast] route1
                             : MultiCast Completed body =
2020-07-03 14:31:40.291  INFO 363488 --- [ #5 - Multicast] route1
                             : After setting new body =>



And strangely, the response received by http client is as follows

=> data1data2data3data4

Am just trying to understand how the flow works. Isn't the 2 logs supposed
to be printed after the multicast aggregator is finished executing? And how
come setBody and Transform EIP isn't replacing the output from the
aggregator "stringConcatStrategy"?


Am using camel v 2.24.0 for this experiment.

Cheers

Reji Mathews

Reply via email to