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: Split / aggregate using custom beans
Date Wed, 02 Sep 2009 04:39:25 GMT
Hi

Supply the split expression as parameters to the splitter instead of
using split().
Use split( insert expression here).

Then the java compiler will be able to keep the scope of the route.

Java land is a bit limited what you can do to simulate DSL.



On Wed, Sep 2, 2009 at 12:04 AM, snowbug<laji.inbox@gmail.com> wrote:
>
> I am having problems to use split and aggregate with custom beans.
>
> I have defined two beans: mySplitter and myAggregator, with myAggregator
> implements the AggregationStrategy.
>
> What I'd like to achieve is use mySplitter to split messages, do some
> processing on each splitted message, then use myAggregator to merge the
> responses, then continue processing with the merged message.
>
> I am expecting to use a route DSL like:
> from("direct:start").split().method("mySplitter",
> "mySplitMethod").to("bean:partProcessing").aggregate("myAggregator");
>
> But the split().method() returns a Object type that does not allow me to
> append further methods (note that split() and split(Expression) returns
> different types). The sample on
> http://camel.apache.org/splitter.html this wki page  shows:
> from("direct:body")
>        // here we use a POJO bean mySplitterBean to do the split of the
> payload
>        .split().method("mySplitterBean", "splitBody")
>        .to("mock:result");
> which does not work in my case due to the mentioned problem.
>
>
> There is no split method that takes bean method parameter and an aggregator,
> it seems that I must implement the Expression interface in mySplitter class
> in order to use the split(Expression, AggreationStrategy) method.
>
> So what is the correct way of using split and aggregate with custom beans?
>
> Thanks,
>
>
> --
> View this message in context: http://www.nabble.com/Split---aggregate-using-custom-beans-tp25247219p25247219.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

Mime
View raw message