camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From RobMMS <robert.pel...@t-systems-mms.com>
Subject ExchangePatterns on Bean-Component
Date Mon, 27 Oct 2008 12:15:24 GMT

Hi,
I'm observing a somewhat strange behaviour in my route:

from("direct:start").multicast(new MyOutAggregationStrategy(),
true).to("direct:a", "direct:b");

from("direct:a").process(new myProcessor()).bean(beanA,
"methodA").to("direct:merge");
from("direct:a").process(new myProcessor()).bean(beanB,
"methodB").to("direct:merge");

from("direct:merge").
 aggregator(header(QueryPreProcessor.HEADER_CORRELATION_ID), new
ResultAggregationStrategy()).
 completedPredicate(header("aggregated").
 isEqualTo(header("parallelStagesCount"))).
to("mock:end");

List result =(List) template.sendBody("direct:start", ExchangePattern.InOut,
myQueryString);


What I want to do here is, I send a query-String to direct:a, which then
multicasts to my parallel working beans, that each take a String value as
paramter in methodA/B and return a ResultObjectA/B which is set as Body
automatically (I do not set this explicitly in the beans).
My ResultAggregationStrategy then puts ResultObjectA and ResultObjectB into
als List-List which I want to get back as result of the template.sendbody
call.


The problem is that my result is most of the time the return value of the
first bean being processed, only sometimes (like 10% of the time) it returns
the aggregated list as expected.

I would expect the my route processes each step an when the aggregated
message reaches mock:end the message's out body is returned to the caller ->
result
I'm not quite sure when I have to set the message's Out-Body and when it's
ok to set the In-Body, because I think thats the problem here, but I'm not
sure.

Maybe I'm completely wrong, so I hope you get what I need and tell me whats
wrong with my route ;)


Thanks, 
Rob
-- 
View this message in context: http://www.nabble.com/ExchangePatterns-on-Bean-Component-tp20186540s22882p20186540.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message