@Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
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;
}
};
@SuppressWarnings("unchecked")
AggregationStrategy brothersAggregator = new AggregationStrategy() {
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
debugIn("Brothers Aggregator", oldExchange, newExchange);
Exchange answer = newExchange;