You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by bhushand <bh...@yahoo.co.in> on 2013/05/01 17:02:53 UTC

Re: not getting combined response from aggregator

Hi 
    Any suggestions???



--
View this message in context: http://camel.465427.n5.nabble.com/not-getting-combined-response-from-aggregator-tp5731362p5731861.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: not getting combined response from aggregator

Posted by bhushand <bh...@yahoo.co.in>.
Hi Sachin
     That works for me.
     Thanks a lot 



-Bhushan



--
View this message in context: http://camel.465427.n5.nabble.com/not-getting-combined-response-from-aggregator-tp5731362p5731945.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: not getting combined response from aggregator

Posted by Sachin <sa...@gmail.com>.
Can you try using adding all your response in a list in your aggregation
strategy. It works for me like below:

AggregationStrategy surnameAggregator = new AggregationStrategy() {
            @SuppressWarnings("unchecked")
            public Exchange aggregate(Exchange oldExchange, Exchange
newExchange) {
                debugIn("Surname Aggregator", oldExchange, newExchange);
 
                Exchange answer = newExchange;
 
                if (oldExchange != null) {
                    List<String> brothers =
oldExchange.getIn().getBody(List.class);
                    brothers.add(newExchange.getIn().getBody(String.class));
                    answer = oldExchange;
                } else {
                    List<String>brothers = new ArrayList<String>();
                    brothers.add(newExchange.getIn().getBody(String.class));
                    newExchange.getIn().setBody(brothers);
                }
 
                debugOut("Surname Aggregator", answer);
 
                return answer;
            }
        };
 

You can refer to below link for more agrregation examples:
http://massapi.com/class/ag/AggregationStrategy.html




--
View this message in context: http://camel.465427.n5.nabble.com/not-getting-combined-response-from-aggregator-tp5731362p5731865.html
Sent from the Camel - Users mailing list archive at Nabble.com.