You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by yvesdm <yv...@gmail.com> on 2013/12/20 16:09:02 UTC

Re: Splitting, processing and aggregating a list

I found this old post while I was trying to do same thing but using a class
that extends AbstractListAggregationStrategy to rebuild a List after the
completion of the split.

Using this aggregator way of doing, I found a problem : at the end of the
split, the body is not replaced by the agregated list ->
AbstractListAggregationStrategy.onCompletion(Exchange exchange) is never
called.


Here is what I do :

from(HANDLE_A_LIST)//
            .split(body(), new ListAggregationStrategy())// body is an
arrayList of String
            .to("log:foo")//
            .end()// end split
            // the body is a string instead of a List
            .end()// end route

    
class ListAggregationStrategy extends
AbstractListAggregationStrategy<String>
    {

        @Override
        public String getValue(Exchange exchange)
        {
            return exchange.getIn().getBody();
        }
    }

Is it a bug ?
As workaround, I use .setBody(property(Exchange.GROUPED_EXCHANGE)) after the
end of the split.

Kind Regards,

Yves.



--
View this message in context: http://camel.465427.n5.nabble.com/Splitting-processing-and-aggregating-a-list-tp5716013p5745127.html
Sent from the Camel - Users mailing list archive at Nabble.com.