camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Splitting, processing and aggregating a list
Date Fri, 13 Jul 2012 15:38:04 GMT
On Fri, Jul 13, 2012 at 5:33 PM, ben1729 <bmumford@scottlogic.co.uk> 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

Mime
View raw message