Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 32359 invoked from network); 5 Aug 2009 10:30:44 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Aug 2009 10:30:44 -0000 Received: (qmail 4129 invoked by uid 500); 5 Aug 2009 10:30:51 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 4071 invoked by uid 500); 5 Aug 2009 10:30:51 -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 4061 invoked by uid 99); 5 Aug 2009 10:30:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Aug 2009 10:30:51 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of claus.ibsen@gmail.com designates 209.85.218.214 as permitted sender) Received: from [209.85.218.214] (HELO mail-bw0-f214.google.com) (209.85.218.214) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 05 Aug 2009 10:30:40 +0000 Received: by bwz10 with SMTP id 10so3454606bwz.20 for ; Wed, 05 Aug 2009 03:30:19 -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=Fz/kMC/YCHQEBOof00iwzYDjTT2szIFZQDBkFlGbHC0=; b=BZOhxw0SYuEjqChx3X1t0qm3udctegch6dES7cck1Lstl6e+lCrZZ7iySgtJze0+Lw wHd3qwLM4P76/FokalgOWh3Fvxh8luFUJbWfIf62kLH2pjx2zbbTW6uTRNEkXayojBtI SLD2M03Qihr3x6TRhiy3hZCokk0Ec0NrnaK08= 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=lH6SsnSSI7GaQENXSAXuui0G8zIew/3W9vPW34mKVvT9HfXV5XL/fqRLudIw0kRwSh sNZCvZEFvzSnI2DJyRNKwsgw2NKaQPCYyDQqUdxMyvxyPLYAxchr7vGcA4yHWIq/S5/M ufVs54vwljblgXVk4GJMPd/wubuoUSmxYXOFQ= MIME-Version: 1.0 Received: by 10.204.65.1 with SMTP id g1mr765611bki.57.1249468219081; Wed, 05 Aug 2009 03:30:19 -0700 (PDT) In-Reply-To: <24824055.post@talk.nabble.com> References: <24822021.post@talk.nabble.com> <5380c69c0908050213w7b37ebb5qa323f7e3830b3e6b@mail.gmail.com> <24824055.post@talk.nabble.com> From: Claus Ibsen Date: Wed, 5 Aug 2009 12:29:59 +0200 Message-ID: <5380c69c0908050329u49142f3fma9913b0e215a1eb@mail.gmail.com> Subject: Re: Route definition with aggregation 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 Wed, Aug 5, 2009 at 12:04 PM, lauri.siltanen w= rote: > > Hi, Claus > > Yes, unfortunately, aggregation is required for handling the messages. Bu= t I > was able to make it work using the .end() approach. Since that may look > confusing to everyone else, I'll give the direct enpoint a go. > > I did actually have a "dummy" endpoint in use, much like the direct endpo= int > you're suggesting, but it was my own endpoint and it seemed a bit clumsy.= I > wasn't aware of the direct endpoint at the time. It looks a lot less like= a > kludge :) > > Thanks a lot for the quick answer! Glad you got it working. Yeah I like to divide my routes into smaller pieces and like them using dir= ect. Then its also easier to test the different routes individually and later the "big picture". I guess if we had an alias for direct, like "link" or "link-route" or something then it would be more obvious to use it? > > Lauri > > > > Claus Ibsen-2 wrote: >> >> Hi >> >> Are you sure you want to use an aggregator? >> When reading it is sounds like you want to do >> >> from A -> B -> choice when (X) -> C >> >> from(EndpointA) >> =A0.to(EndpointB) >> =A0.choice() >> =A0 =A0 .when(aggregationPredicate).to(EndpointC) >> =A0 .end(); >> >> >> You can use the "direct" endpoint to link routes together so if you >> have trouble with having aggregator nested >> then just route to a "direct:foo" endpoint and then do a >> >> from("direct:foo").aggreagate... >> >> You can also try adding a .end() in your route to help Camel denote >> the end of the when / choice / aggregate blocks. >> >> >> On Wed, Aug 5, 2009 at 9:27 AM, lauri.siltanen >> wrote: >>> >>> I have a bunch of messages that need to be routed from EndpointA to >>> EndpointB, always. In addition, sometimes these messages need to be >>> aggregated to EndpointC. So always to B, sometimes to C. >>> >>> I have tries to achieve this by the following DSL definition: >>> >>> from(EndpointA).choice() >>> =A0.when(aggregationPredicate) >>> =A0 =A0.aggregate(myAggregationCollection).to(EndpointC) >>> =A0.when(endpointBPredicate) >>> =A0 =A0.to(EndpointB) >>> =A0.otherwise() >>> =A0 =A0.to(deadLetters); >>> >>> This does not work due to the fact that to(EndpointC) is of type >>> AggregationDefinition instead of ChoiceDefinition and therefore cannot = be >>> followed by .when(endpointBPredicate). >>> >>> >>> >>> The other definition I tried was the following: >>> >>> from(EndpointA).choice() >>> =A0.when(aggregationPredicate) >>> =A0 =A0.aggregate(myAggregationCollection).to(EndpointC); >>> >>> from(EndpointA).choice() >>> =A0.when(endpointBPredicate) >>> =A0 =A0.to(EndpointB) >>> =A0.otherwise() >>> =A0 =A0.to(deadLetters); >>> >>> What happens here is that every other time the messages go to the first >>> from(EndpointA).choice() and every other time they go to the second >>> from(EndpointA).choice(). I would like them to go to both. >>> >>> How do I go about getting the messages to both endpoints when the >>> predicates >>> return true? >>> >>> Thanks, >>> Lauri >>> -- >>> View this message in context: >>> http://www.nabble.com/Route-definition-with-aggregation-tp24822021p2482= 2021.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >> > > -- > View this message in context: http://www.nabble.com/Route-definition-with= -aggregation-tp24822021p24824055.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > --=20 Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus