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 65D92E7DE for ; Sat, 1 Dec 2012 11:00:37 +0000 (UTC) Received: (qmail 81484 invoked by uid 500); 1 Dec 2012 11:00:37 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 81369 invoked by uid 500); 1 Dec 2012 11:00:36 -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 81341 invoked by uid 99); 1 Dec 2012 11:00:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Dec 2012 11:00:35 +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 (nike.apache.org: domain of raul@evosent.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; Sat, 01 Dec 2012 11:00:27 +0000 Received: by mail-lb0-f173.google.com with SMTP id c1so1347864lbg.32 for ; Sat, 01 Dec 2012 03:00:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-originating-ip:in-reply-to:references:date :message-id:subject:from:to:content-type:x-gm-message-state; bh=ntnpwCpNmWsFfIi/FC3F1vrWUgksMjivBt1reNXj1/A=; b=TiccxMq3z+w0CNBTgFFvxmj2XqSy3niIdD0yEJVdlHCMSble2U/16cwm1LrVuasu6a vwKIygWwSEN+njf3IqKRzIBwiwCrqU0LZtCfochuToue24J3ig0V7IG4iMg85KJmHSwB k2EROROez1/R+uZsG2KFdnH8S6dLYx87vwHmqraipHMEGuZDXiH/J6z5CXbcWtFIBq3c vG76xCurcRQF6IPgsXwokjIxC79Ch/H2E7C7qNau+5pooBqlHH2bkBMsx1C+jssSAfR7 bI+hjdaxKfgd9z3bD30di8knsQR+T+yGCj0YFFAncLGszq1qsmu/zpcJvlqeD8CoYdgS u6jw== MIME-Version: 1.0 Received: by 10.152.104.148 with SMTP id ge20mr3902004lab.51.1354359606695; Sat, 01 Dec 2012 03:00:06 -0800 (PST) Received: by 10.114.38.226 with HTTP; Sat, 1 Dec 2012 03:00:06 -0800 (PST) X-Originating-IP: [2.139.64.93] Received: by 10.114.38.226 with HTTP; Sat, 1 Dec 2012 03:00:06 -0800 (PST) In-Reply-To: References: Date: Sat, 1 Dec 2012 11:00:06 +0000 Message-ID: Subject: Re: Splitter and combining messages / exchanges From: Raul Kripalani To: users@camel.apache.org Content-Type: multipart/alternative; boundary=f46d040711694156fb04cfc86b5f X-Gm-Message-State: ALoCoQluwGTQ1KYrVmwK8wyr+VhxCGvF2w8OYXlyCMq6bs21N8Kapb8c3YNZ0s75ZDvk8jvfNydq X-Virus-Checked: Checked by ClamAV on apache.org --f46d040711694156fb04cfc86b5f Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I would suggest the following pipeline: - Before the splitter, read the first line and store it in a property - Run the splitter, and for every element concatenate the above property with the incoming line - Discard the first Exchange, by using a filter EIP to only allow messages whose header CamelSplitIndex is greater than 1 or 2 (can't remember if the index starts at 0 or 1). Does this approach help? Just to clarify, you wouldn't be using the aggregator EIP at all. Regards, Ra=FAl. Sent from a mobile device On 30 Nov 2012 22:33, "Oliver Geisser" wrote: > Hi Claus, > > thanks for your help. I've checked the Composed Message Processor EIP. > > Maybe I'm missing something but as far as I can see the EIP will not work > for my use case. > > Let's recap my problem with the input file > > Hello > A > B > C > ... > > Because it's a very large file it will be splitted in streaming mode. > Therfor > every line becomes a separate Message. > > Using the Aggregator the "Hello" Message will be stored in the > AggregationRepository. > The the second message ("A") will be aggregated with "Hello" to "Hello A"= . > And now the important point: the "completion predicate" is now true and t= he > meesage is released from the Aggregator, e.g. > AggregateProcessor.onCompletion will > be called and the "Hello" Exchange is removed from the > AggregationRepository. > > The Exchange needs to be released (completed) at this point because it is= a > big file and > we need to operate in streaming mode. > > Now the third message ("B") comes in. Because the "Hello" Exchange was > removed > we can not aggregate the Exchanges to "Hello B" anymore. > > So the question remains: what is the best way to solve the given problem > (see below) with Camel? > > One idea I had was to mimic the Aggregate Repository but without removing > the "Hello" Exchange > after combining it with the "A", "B", "C", etc. messages. > > But is this really the best solution for my problem? > > What I need is access to a storage location which is scoped to the > "Splitter input Exchange" > during processing the "splitted" Exchanges. For example: if it would be > possible to access > the "input" Exchange during processing the "splitted" Exchanges I would s= et > a property > on the "input" Exchange during processing the first line and reading it > afterwards during > processing the remaining lines. > > Is there any other storage location besides an Exchange property which is > scoped to the > Exchange and is accessible from the "splitted" Exchanges? > > Greetings > Oliver > > > > 2012/11/30 Claus Ibsen > > > Hi > > > > See this EIP > > http://camel.apache.org/composed-message-processor.html > > > > On Thu, Nov 29, 2012 at 11:27 PM, Oliver Geisser > > wrote: > > > Hello, > > > > > > I am using a splitter to handle a big txt file (streaming mode). I ne= ed > > to > > > combine the first line > > > with all the other lines and store each result into a database. > > > > > > What is a good Camel solution for this? > > > > > > Example input file: > > > > > > Hello > > > A > > > B > > > C > > > ... > > > > > > > > > This needs to be combined into: > > > > > > Hello A > > > Hello B > > > Hello C > > > ... > > > > > > Every result is stored into a database. > > > It's important to use streaming because of the size of the input file= . > > > > > > > > > My first idea was to use a Splitter and then store the first line int= o > an > > > Exchange property. > > > But this does not work because the Splitter creates new Exchanges for > > every > > > line. > > > > > > So how do I combine the first line with all the other lines? > > > > > > Thanks > > > Oliver > > > > > > -- > > > og > > > > > > > > -- > > Claus Ibsen > > ----------------- > > Red Hat, Inc. > > FuseSource is now part of Red Hat > > Email: cibsen@redhat.com > > Web: http://fusesource.com > > Twitter: davsclaus > > Blog: http://davsclaus.com > > Author of Camel in Action: http://www.manning.com/ibsen > > > > > > -- > og > --f46d040711694156fb04cfc86b5f--