camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Breitenstein <>
Subject Re: How to aggregate all messages into a single message?
Date Tue, 25 Feb 2014 10:24:51 GMT

we aggragate all messages having the same key like this:

GroovyExpression(""), new 

and get a List as result ("isStoreAsBodyOnCompletion() returns true").

The QuoteAggregationStrategy is required to implement the abstract 
method <T> getValue(final Exchange exchange) to convert the message to a 
specific type.
In case you do not have a aggregateble key you can have a look at 
AbstractListAggregationStrategy and all derived classes, maybe one fits 
because you need some state to keep track about the number of exchanges 
combined and the desired chunk size. Maybe you create your own 
aggregator derived from AbstractListAggregationStrategy and override 
this method:

     public Exchange aggregate(Exchange oldExchange, Exchange newExchange)



Am 25.02.14 10:11, schrieb tharangage:
> I am having another issue based on same solution given by "dulanov".
> Is it possible to group N lines together?
> I come up with solution as follow without aggregation, but it is better if i
> can use aggregation as describe in this post. Can anyone please help on
> this?
> from("file:/temp/test").split().tokenize("\n", 100).process(new
> MyProcessor()).to("file:/home/test/dest?fileExist=Append");
> --
> View this message in context:
> Sent from the Camel - Users mailing list archive at

View raw message