On Fri, Jul 3, 2020 at 9:13 PM Reji Mathews <contactr...@gmail.com> wrote:
>
> Thanks for that quick response. What if I need to have more processing
> after the multi-cast eip? Suppose I want to use the aggregated output and
> perform some massaging and push it into another remote service endpoint?
>

Yeah thats the point what comes after end is the output of the multicast



> Is that possible?
>
> On Fri, Jul 3, 2020 at 2:56 PM Claus Ibsen <claus.ib...@gmail.com> wrote:
>
> > Hi
> >
> > You need to end the multicat assuming you only want to call a and b
> >
> >
> > .multicast(stringConcatStrategy).parallelProcessing(true).to("direct:a","direct:b")
> >
> > should be
> >
> >   .multicast(stringConcatStrategy).parallelProcessing(true)
> >       .to("direct:a","direct:b")
> >    .end()
> >
> > On Fri, Jul 3, 2020 at 8:37 PM Reji Mathews <contactr...@gmail.com> wrote:
> > >
> > > 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
> >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to