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 70FDFD698 for ; Fri, 13 Jul 2012 15:38:54 +0000 (UTC) Received: (qmail 36202 invoked by uid 500); 13 Jul 2012 15:38:54 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 35935 invoked by uid 500); 13 Jul 2012 15:38:53 -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 35903 invoked by uid 99); 13 Jul 2012 15:38:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Jul 2012 15:38:52 +0000 X-ASF-Spam-Status: No, hits=0.6 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,URI_HEX 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; Fri, 13 Jul 2012 15:38:48 +0000 Received: by lbok6 with SMTP id k6so5954032lbo.32 for ; Fri, 13 Jul 2012 08:38:26 -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=pTlWhpCdUs4IWOydtRFGuT3Ygf1v1mid6dOHpJDBVp0=; b=Ljcx62tP5H5uuvDsKEHywRsPJNu4fSFz9flQXq8G+HK8l976Z0YnzgmuIhehbog86h XlUtpPd5aQbvpoY3iY2gFy7y6mmt7ObABJj9+Xlq3JWjZcRosVXnmOQJAmw4+GA7gryJ F7uGNZRrXLkacXxkMmvwJwalILtJ4ERvLj1qHpAWwgqasSJqmoj3gHtb5psmvsD9Ll2j B9UBywM5iEGRC5jBJuCR2Lq1BChJtZtLOz3xwEsDD5COIWMAbqNKz3fN508SkNC+qx7v eaWhhruvXKtUSZnKrQjFx4QBntIXVR3xH98ZamYTi9AAcLos48eHDS0CW3SQWt5MBar5 DoMw== Received: by 10.152.46.232 with SMTP id y8mr1899831lam.18.1342193906462; Fri, 13 Jul 2012 08:38:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.49.73 with HTTP; Fri, 13 Jul 2012 08:38:04 -0700 (PDT) In-Reply-To: <1342193614631-5716013.post@n5.nabble.com> References: <1342193614631-5716013.post@n5.nabble.com> From: Claus Ibsen Date: Fri, 13 Jul 2012 17:38:04 +0200 Message-ID: Subject: Re: Splitting, processing and aggregating a list To: users@camel.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org On Fri, Jul 13, 2012 at 5:33 PM, ben1729 wrote: > Hi all, > > I would like to take a message containing a list of objects, split the list > into it's component objects, process them in parallel, aggregate the > modified objects back into a list. > > I am using camel 2.8.0. > > From what I can see I need to use a route in the following form: > > from("jms:queue:from") > .split(Expression, AggregationStrategy) // What goes here? > .parallelProcessing() > // Processing goes here > .end() > .to("direct:end"); > > I think I can write the aggregation strategy but I'm unsure how to split the > list in the Expression. All the example seems to be with splitting strings. > You can use a method call expression (also known as bean in the DSL), and just return a List, or Iterator etc. that contains the bodies to split. In newer releases of Camel, there is also a method to indicate a method call expression. .split(bean(MySplliterBean.class, AggregationStrategy) // What goes here? And then just have a single public static method on the class. And you can use the bean parameter binding for the method signature. And then return a List / Iterator / etc. > Ben > > -- > View this message in context: http://camel.465427.n5.nabble.com/Splitting-processing-and-aggregating-a-list-tp5716013.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- 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