camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sachin <sachin2...@gmail.com>
Subject Re: not getting combined response from aggregator
Date Wed, 01 May 2013 15:22:32 GMT
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.

Mime
View raw message