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 A98A0107ED for ; Wed, 13 Nov 2013 18:36:56 +0000 (UTC) Received: (qmail 69771 invoked by uid 500); 13 Nov 2013 18:36:56 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 69560 invoked by uid 500); 13 Nov 2013 18:36:55 -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 69552 invoked by uid 99); 13 Nov 2013 18:36:55 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Nov 2013 18:36:55 +0000 X-ASF-Spam-Status: No, hits=2.3 required=5.0 tests=FORGED_YAHOO_RCVD,SPF_PASS,URI_HEX X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [216.139.236.26] (HELO sam.nabble.com) (216.139.236.26) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Nov 2013 18:36:51 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1VgfIk-0007u5-2L for users@camel.apache.org; Wed, 13 Nov 2013 10:36:30 -0800 Date: Wed, 13 Nov 2013 10:36:30 -0800 (PST) From: cristisor To: users@camel.apache.org Message-ID: <1384367790062-5743205.post@n5.nabble.com> In-Reply-To: <1384360359174-5743196.post@n5.nabble.com> References: <1383652661153-5742649.post@n5.nabble.com> <1383659316479-5742655.post@n5.nabble.com> <1608C919-B791-4556-98DC-1B34A3C335AA@gmail.com> <1384360359174-5743196.post@n5.nabble.com> Subject: Re: count of processed messages when using aggregation MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org You could set a count header on each exchange which leaves ".bean("myProcessor", "doWork")" and in the end log the number of the last exchange or have the ".bean("myProcessor", "doWork")" increase an internal counter and when you receive CamelSplitComplete you go into the myProcessor bean again and log the counter value, then you reset it so that a new csv can start from 0. Something like this: from("file:input.csv") .unmarshal().csv().split(body()).streaming().parallelProcessing() .bean("myProcessor", "doWork") // inside the doWork method you increase the counter .aggregate(constant("id"), new Aggregator()).completionSize(100).completionTimeout(1000) .parallelProcessing() // why would you need this one? .to("remote") .choice() .when(property("CamelSplitComplete").isEqualTo("true")) .bean("myProcessor", "logCounterAndResetCounter") .otherwise() .log("lfile not completed yet"); If sending to the remote server is time consuming and you need performance then you could do something like this to increase the performance: .aggregate(constant("id"), new Aggregator()).completionSize(100).completionTimeout(1000) .to("seda:queueName"); .from("seda:queueName") .to("remote") This will put the aggregated exchanges on another thread which will take care of the sending and logging while the initial thread continues to process csv lines without having to wait for the remote machine to acknowledge the aggregated exchanges. -- View this message in context: http://camel.465427.n5.nabble.com/count-of-processed-messages-when-using-aggregation-tp5742649p5743205.html Sent from the Camel - Users mailing list archive at Nabble.com.