Return-Path: X-Original-To: apmail-camel-users-archive@www.apache.org Delivered-To: apmail-camel-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 98C81CDAD for ; Wed, 13 Jun 2012 05:07:22 +0000 (UTC) Received: (qmail 50835 invoked by uid 500); 13 Jun 2012 05:07:22 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 50803 invoked by uid 500); 13 Jun 2012 05:07:22 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 50782 invoked by uid 99); 13 Jun 2012 05:07:21 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jun 2012 05:07:21 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.217.173 as permitted sender) Received: from [209.85.217.173] (HELO mail-lb0-f173.google.com) (209.85.217.173) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jun 2012 05:07:17 +0000 Received: by lbok6 with SMTP id k6so1156599lbo.32 for ; Tue, 12 Jun 2012 22:06:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=X/bRhuePTirlIQP508zH5gAKTu09TPBnI+vTDoE9IXg=; b=XiBPeNcCeyrh5BCZGwD7/oPjWFanfrDHMl+Ho748xs3JTIbXWCZy0zZIF8ZSB0dG8k ka91ViE1LxiDubQCprPYd079wFeqI2wqFOxouHlsF0s3w6KugVpvp4S3Qm5KaP8+XT1e EzlINDVeFCHwYB3rPAWjK9lueZyg+Le738U7IQDTeO6op8jESupo4IptCRcCV/9YdNm4 rp4XYRud3iu5GNppPg3LMF/j+W5DZjnXpH04xOLd73UHy+M3+s/v4UFbMx5s6mqn+3S+ ZIg25Mdlhpp53rkrAfJK1rTll2t0fKNDf7me8+MWbaP+4cOI8Kgr9DHy5ztuQ2+l7n92 rAFw== Received: by 10.112.36.34 with SMTP id n2mr5892698lbj.62.1339564015726; Tue, 12 Jun 2012 22:06:55 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.49.73 with HTTP; Tue, 12 Jun 2012 22:06:35 -0700 (PDT) In-Reply-To: <92E9007C7E5AD14F99C47C01B2606618084EF658@EXUAU020HWT105.oceania.corp.anz.com> References: <92E9007C7E5AD14F99C47C01B2606618084EF658@EXUAU020HWT105.oceania.corp.anz.com> From: Claus Ibsen Date: Wed, 13 Jun 2012 07:06:35 +0200 Message-ID: Subject: Re: Split, filter, aggregate zero messages To: users@camel.apache.org Content-Type: multipart/alternative; boundary=e0cb4efe34ec4fb05804c2538db5 X-Virus-Checked: Checked by ClamAV on apache.org --e0cb4efe34ec4fb05804c2538db5 Content-Type: text/plain; charset=ISO-8859-1 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 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 --e0cb4efe34ec4fb05804c2538db5--