camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From panto <panos.antona...@upstreamsystems.com>
Subject Empty BODY after Aggregation Strategy and convert to String
Date Fri, 31 Jul 2015 17:18:07 GMT
Hello all,

I am using CAMEL 2.15.1 in order to listen to an inbound endpoint, route to
a couple of direct (in order to be sync) outbound endpoints aggregating the
responses with following implementation:

Code from my inbound route:
<code>
def = def
.streamCaching()
	.recipientList()
		.method(router, RecipientListRouter.METHOD_NAME)
		.aggregationStrategy(synchronousAggregationStrategy)
		.convertBodyTo(String.class)
	.end()
.end();
</code>

Code in my synchronousAggregationStrategy:
<code>
if (oldExchange == null) {
Object myBody = CamelHelper.getMessage(newExchange).getBody()
CamelHelper.getMessage(newExchange).setBody(myBody, String.class));
return newExchange;
}
</code>


Code from my inbound routes:
<code>
from("direct:"+ internalEndpoint)
	.streamCaching()
	.etc()
.end();
</code>


The problem is that *myBody* object is instance of
*CachedOutputStream.WrappedInputStream* class and although I can see with
the debugger the desired context in CachedOutputStream.currentStream object,
when it is set to the exchange as a String I get null!

Any ideas? I have put streamCaching() in both my routes (it cannot be set
inside RecipientList's sub-route), I have put convertBodyTo(String.class)
after the aggregation, what else?

Thanks in advance,
Panos





--
View this message in context: http://camel.465427.n5.nabble.com/Empty-BODY-after-Aggregation-Strategy-and-convert-to-String-tp5770184.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message