camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snowbug <laji.in...@gmail.com>
Subject Split / aggregate using custom beans
Date Tue, 01 Sep 2009 22:04:14 GMT

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.


Mime
View raw message