Hello, I have a route that should process request from CXF endpoint and return results as JSON:
public class MyRoute extends RouteBuilder { // ... Autowired: // msgRequestProcessor - converts json {string,string} to String of "\n" delimited json string: {string}\n{string} // RangeProcessor, SingleProcessor - create mongodb Criteria object from json string // msgTypeMapper - adds corresponding header "msg.type" @Override public void configure() { from("direct:list") .process(msgRequestProcessor) .split(body()) .bean(msgTypeMapper.class) .choice() .when(header("msg.type").isEqualTo("single")) .log("Go to direct:single") .to("direct:single") .otherwise() .log("Go to direct:range") .to("direct:daterange") .end() .to("direct:aggregate"); from("direct:range") .process(new RangeProcessor()); from("direct:single") .process(new SingleProcessor()); from("direct:aggregate") .aggregate(new MyAgg()).header("msg.collection").completionSize(2) .log("RETVAL: ${body}") .marshal().json(JsonLibrary.Gson).end(); } public static final class MyAgg implements AggregationStrategy { @Override public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { if (oldExchange == null) { return newExchange; } Criteria oldCriteria = oldExchange.getIn().getBody(Criteria.class); Criteria newCriteria = newExchange.getIn().getBody(Criteria.class); Criteria criteria = new Criteria(); criteria.andOperator(oldCriteria, newCriteria); oldExchange.getIn().setBody(criteria.getCriteriaObject().toString()); return oldExchange; } } } Everything works fine, I see correct aggregation results and aggregation completion in the log but CXF endpoint always returns output of msgRequestProcessor (before split): {"string"} {"string"} while I expect to see Criteria object converted to string (that I can see in the logs). Any help would be much appreciated! Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-return-split-results-to-CXFRS-endpoint-tp5780580.html Sent from the Camel - Users mailing list archive at Nabble.com.