camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Split, filter, aggregate zero messages
Date Wed, 13 Jun 2012 05:06:35 GMT
Hi

The splitter has built in aggregation strategy, so I suggest to use that

eg its this pattern
http://camel.apache.org/composed-message-processor.html

See the example with only splitter, where you dont need the aggregator EIP


On Wed, Jun 13, 2012 at 6:38 AM, Gordienko, Max <Max.Gordienko@anz.com>wrote:

>
> Hi,
>
> Is it possible to "aggregate" zero messages with aggregator?
> Here is my case (simplified) tested with Camel 2.9.2
>
>                from("direct:from")
>                .split(body().tokenize("\n"))
>                .filter(body().isNotEqualTo(""))
>                .aggregate(constant(true), new
> MyAggregationStrategy()).completionTimeout(1000)
>                .log(LoggingLevel.INFO, "compleated by
> ${header.CamelAggregatedCompletedBy}").stop();
>
> I get a file, split it into multiple lines, filter all blank lines,
> aggregate it back.
> If the file is empty or contains only blanks the .log line will never be
> executed.
>
> Moreover if MyAggregationStrategy implements
> TimeoutAwareAggregationStrategy the timeout() method is never called.
>
> By the way my case is equal to splitting input into zero elements
> (imagine the input file is empty).
>
> What is the recommended approach to such scenarios?
>
> Thank you!
>
> "This e-mail and any attachments to it (the "Communication") is, unless
> otherwise stated, confidential,  may contain copyright material and is for
> the use only of the intended recipient. If you receive the Communication in
> error, please notify the sender immediately by return e-mail, delete the
> Communication and the return e-mail, and do not read, copy, retransmit or
> otherwise deal with it. Any views expressed in the Communication are those
> of the individual sender only, unless expressly stated to be those of
> Australia and New Zealand Banking Group Limited ABN 11 005 357 522, or any
> of its related entities including ANZ National Bank Limited (together
> "ANZ"). ANZ does not accept liability in connection with the integrity of
> or errors in the Communication, computer virus, data corruption,
> interference or delay arising from or in respect of the Communication."
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message