Here is an example of some off my route:
from("cxf:bean:hubws?dataFormat=MESSAGE").streamCaching().onException(Exception.class).handled(true) .setHeader(HubConstants.DURATION.getValue(), constant("Hub received request")) .multicast().to("direct:channel1", "direct:channel2", "direct:channel3") .aggregationStrategy(new HubAggregationStrategy()).stopOnException(); from("direct:channel1").onException(Exception.class).handled(true).process(new LogError()).end() .setHeader(HubConstants.LOGSTATE.getValue(), constant(HubConstants.MQSTART.getValue())); from("direct:channel2").onException(Exception.class).handled(true). process(new LogError(HubConstants.CHANNEL2.getValue())).end() .setHeader(HubConstants.DURATION.getValue(), constant("Hub sends request")) .bean(AddDuration.class) .recipientList() .method(Util.class, "getEndpoint"); from("direct:channel3").onException(Exception.class).handled(true).process(new LogError()).end() .setHeader(HubConstants.DURATION.getValue(), constant("Hub received response")) .bean(AddDuration.class) .setHeader(HubConstants.LOGSTATE.getValue(), constant(HubConstants.MQSLUT.getValue())); I use the AggregationStrategy, the mqSlut is not null after channel3. public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { if (oldExchange == null) { // the first time we only have the new exchange so it wins the first round return newExchange; } Object mqSlut = newExchange.getIn().getHeader(HubConstants.LOGSTATE.getValue()); if(mqSlut != null) { //newExchange = oldExchange; Object body = oldExchange.getIn().getBody(); newExchange.getIn().setBody(body); } return newExchange; } I allways want the body from channel2 back to the client, thats why: Object body = oldExchange.getIn().getBody(); newExchange.getIn().setBody(body); Now my problem, i want to enrich the document in AddDuration class: public Document enrich(@Headers Map<?, ?> requestHeaders, Document doc, Exchange exchange) throws HubException { try { // append a duration Element documentElement = doc.getDocumentElement(); NodeList elementsByTagNameNS = documentElement.getElementsByTagNameNS("*", "technicalAddress"); String prefix = documentElement.getPrefix(); Element durationElement = doc.createElementNS(HubConstants.CORPORATESERVICE_NAMESPACE.getValue(),"duration"); durationElement.setPrefix(prefix); elementsByTagNameNS.item(0).appendChild(durationElement); Duration duration = getDuration(exchange); Element time = doc.createElementNS(HubConstants.CORPORATESERVICE_NAMESPACE.getValue(),"time"); time.appendChild(doc.createTextNode(String.valueOf(duration.getTime()))); durationElement.appendChild(time); Element point = doc.createElementNS(HubConstants.CORPORATESERVICE_NAMESPACE.getValue(),"point"); point.appendChild(doc.createTextNode(String.valueOf(duration.getPoint()))); durationElement.appendChild(point); if (logger.isInfoEnabled()) { LogXmlUtil.printDocument(doc, System.out); } } catch (Exception e) { throw new HubException("119"); } When i debug thrue the code the document is enriched with a duration in chanel1, chanel2 and chanel3. Thats nice, but, when it gets back to the client, i only have the duration from chanel1 and chanel2. I figuered out thats becouse off the AggregationStrategy, but i dont want to solve this. I still want the reponse back to the client from chanel2, but also with the duration from chanel3, any good ideas out there ? -- View this message in context: http://camel.465427.n5.nabble.com/AggregationStrategy-tp5765514.html Sent from the Camel - Users mailing list archive at Nabble.com.