camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meng <tianmeng...@gmail.com>
Subject Re: Problem: Concatenate the different input(from different route) using aggreagationStrategy
Date Fri, 28 Oct 2016 23:49:55 GMT
Hi Steve, 

Thanks for replying. 
I made some changes, here is the code: 

        from("direct:start") 
                .multicast() 
                .to("direct:route1", "direct:route2") 
                .end() 
                ; 

        from("direct:route1") 
                .multicast() 
                .parallelProcessing() 
                .aggregationStrategy(new JoinReplyAggregationStrategy()) 
                .to(TARGET1, TARGET2, TARGET3, TARGET4, TARGET5, TARGET6,
TARGET7, TARGET8) 

                .end() 
                .process(new Processor() { 
                    @Override 
                    public void process(Exchange exchange) throws Exception
{ 
                        String input =
exchange.getIn().getBody(String.class).replaceAll("}\\+\\{", ","); 
                        exchange.getOut().setBody(input); 
                        System.out.println("*****************"+input); 
                    } 
                }) 
               .to("direct:route2"); 

           from("direct:route2") 
                .process(new Processor() { 
                    @Override 
                    public void process(Exchange exchange) throws Exception
{ 
                        System.out.println("################"); 
                       
System.out.println(exchange.getIn().getBody(String.class)); 
                    } 
                }); 

Let's say 'direct:start' broadcasts message1 to 'direct:route1' and
'direct:route2'. 
'direct:route2' does some processing and get a result message2 then sent it
to 'direct:route2'. 
So 'direct:route2' now receive two massages. I can now print both message1
and message2. But I want to concatenate these two messages in
'direct:route2' as one. Is there any way? 

Thanks, 
Meng 



--
View this message in context: http://camel.465427.n5.nabble.com/Problem-Concatenate-the-different-input-from-different-route-using-aggreagationStrategy-tp5789368p5789426.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message