Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 3285 invoked from network); 7 Oct 2009 16:18:17 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 7 Oct 2009 16:18:17 -0000 Received: (qmail 65202 invoked by uid 500); 7 Oct 2009 16:18:17 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 65175 invoked by uid 500); 7 Oct 2009 16:18:17 -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 65165 invoked by uid 99); 7 Oct 2009 16:18:17 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Oct 2009 16:18:17 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of claus.ibsen@gmail.com designates 209.85.218.216 as permitted sender) Received: from [209.85.218.216] (HELO mail-bw0-f216.google.com) (209.85.218.216) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Oct 2009 16:18:05 +0000 Received: by bwz12 with SMTP id 12so4556700bwz.20 for ; Wed, 07 Oct 2009 09:17:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :from:date:message-id:subject:to:content-type :content-transfer-encoding; bh=5Ml9mEpy4db0p0lSEdB+DtWqfU/yhUL66yRcoWNnfyk=; b=hU9/GDLU6kOyD1T6Jkr645AJojMPSkaC1FvYx+2GRE1ADTfSQ1/UUqvNfHJGJJrlhl b3e6mjiD9XwS3UqGCcBRWABo2QAecQ8S8x6Q4C6a1l1iDeoWRdsltND2k/Onf529jk0R 0mQGc3u3BCttLkKVWR5cAoUFBfqtFvVGRUUPw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding; b=LKNZ12FcjAyaYn5H5dDd+WjDv5yesargPgiat57ddzkL+PHrHiXOSMWqsIUrODMl4S 5CFtW6OCRej/spY/oEPwxWi7NLAydu1hajVoaV0bIGB1ZwyR+rSqTMU1rJrOr80+L0un i7EMknKgeTiMvhNBI9iNSrpGkXOiPtsUacZrw= MIME-Version: 1.0 Received: by 10.204.33.7 with SMTP id f7mr57335bkd.123.1254932263285; Wed, 07 Oct 2009 09:17:43 -0700 (PDT) In-Reply-To: <4ACA1C75.9070807@bull.net> References: <4AC9A6A5.9090301@bull.net> <5380c69c0910050130i3c60d72bnc31686c0f203025@mail.gmail.com> <5380c69c0910050133p26aef935j31ebae50cc133d5f@mail.gmail.com> <4ACA1C75.9070807@bull.net> From: Claus Ibsen Date: Wed, 7 Oct 2009 18:17:23 +0200 Message-ID: <5380c69c0910070917s54c6d36of227c60dd2101ed7@mail.gmail.com> Subject: Re: Route with content split and backup To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Mon, Oct 5, 2009 at 6:19 PM, S. Ali Tokmen w= rote: > Hello > > Thank you for this brilliant example. > > In my use case, I've used the Expression for only creating a recipient li= st, > each of them with direct: destinations, and then some other routes starti= ng > from these direct: endpoints. > > It works well and the routes are easy to read. Glad it worked for you and the routes are easy to read and understand. That is very important IMHO that new users can understand the camel routing. You can misuse the Camel DSL and create long and complex routes just as long and complex methods. So dividing into smaller routes and linking using direct endpoint is great. Just as you would refactor a method into smaller methods. > > Cheers > > S. Ali Tokmen > savas-ali.tokmen@bull.net > > Office: +33 4 76 29 76 19 > GSM: =A0 =A0+33 66 43 00 555 > > Bull, Architect of an Open World TM > http://www.bull.com > > > > Claus Ibsen a =E9crit : >> >> Hi >> >> And notice I use org.apache.camel.Message objects as container for the >> answer to return in the custom Expression. >> I do this as I can then add the custom header with the destination for >> the recipient list EIP. >> >> If I do not do that then I may have to use the Content Based Router >> afterwards and check the content where to route the message. >> >> >> On Mon, Oct 5, 2009 at 10:30 AM, Claus Ibsen >> wrote: >> >>> >>> Hi >>> >>> You can use a custom expression to do the splitting and combined with >>> the recipient list you can in your custom expression also determine >>> where to message should be routed next. >>> >>> See this unit test I added >>> http://svn.apache.org/viewvc?rev=3D821717&view=3Drev >>> >>> >>> >>> On Mon, Oct 5, 2009 at 9:56 AM, S. Ali Tokmen >>> wrote: >>> >>>> >>>> Hello >>>> >>>> I'm trying to create a route which does the following: >>>> >>>> =A0* Reads a file from the /input path, containing Java-property-like >>>> =A0 =A0entries. Let's assume it for example contains: >>>> =A0 =A0 =A0 =A0o p1 =3D x >>>> =A0 =A0 =A0 =A0o p2 =3D y >>>> =A0 =A0 =A0 =A0o p3 =3D z >>>> =A0 =A0 =A0 =A0o p4 =3D t >>>> =A0* Splits the file into two files and puts it into /output_2 and >>>> =A0 =A0/output_3 >>>> =A0 =A0 =A0 =A0o /output_2 should only receive the properties p1 and p= 2, e.g.: >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0+ p1 =3D x >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0+ p2 =3D y >>>> =A0 =A0 =A0 =A0o /output_3 should only receive the properties p1 and p= 3, e.g.: >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0+ p1 =3D x >>>> =A0 =A0 =A0 =A0 =A0 =A0 =A0+ p3 =3D z >>>> =A0* Once the writing of these files finished, move the original file >>>> =A0 =A0in /input into /backup >>>> >>>> I'm attaching some images for illustrating this. >>>> >>>> Now, here's the issue: when I do a route like the following: >>>> >>>> =A0from("file:/input"). >>>> =A0to("direct:output_2", "direct:output_3"). >>>> =A0to("file:/backup"); >>>> >>>> =A0from("direct:output_2").process(OnlyKeepPropertyProcessor("p1", >>>> =A0"p2").to("file:/output_2"); >>>> =A0from("direct:output_3").process(OnlyKeepPropertyProcessor("p1", >>>> =A0"p3").to("file:/output_3"); >>>> >>>> Then only p1 and p2 is passed to the process3, and the file in /output= _3 >>>> contains only p1. Worse, the backup only backs up what's in output_3..= . >>>> >>>> What is the good EIP for such a route? >>>> >>>> Thanks >>>> >>>> -- >>>> >>>> S. Ali Tokmen >>>> savas-ali.tokmen@bull.net >>>> >>>> Office: +33 4 76 29 76 19 >>>> GSM: =A0 =A0+33 66 43 00 555 >>>> >>>> Bull, Architect of an Open World TM >>>> http://www.bull.com >>>> >>>> >>>> >>> >>> -- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> Twitter: http://twitter.com/davsclaus > > --=20 Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus