Here is my route:
def.convertBodyTo(String.class).split()
.method(splittingProcessor, "split")
.aggregationStrategy(myAggregationStrategy)
.bean(myProcessor, "aMethod")
.end();
I am trying to send one exchange to more than two different HTTP endpoints.
Here is my aggregation strategy:
@Override
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
Message inMsg = newExchange.getIn();
String body = inMsg.getBody(String.class);
String oldBody= "";
if (oldExchange == null) {
return newExchange;
}
else {
oldBody = oldExchange.getIn().getBody(String.class);
oldExchange.getIn().setBody(oldBody + " "+body);
return oldExchange;
}
}
but
body is always equal to "" and inMsg is "[Body is instance of java.io.InputStream]"
convertBodyTo(String.class) does not work either (at least the way I am using it).
What am I doing wrong?
PS. streamCaching() on the route or setStreamCache(true) on the context also do not work.
EDIT 1:
Camel Version: 2.12.13
In aMethod I am using a ProducerTemplate to send the exchange to an HTTP Endpoint:
exchange = producerTemplate.send(uri, exchange);
and after that I do some processing to the exchange body.
I have noticed that the same thing works if I use the direct component.