camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davsclaus <>
Subject Re: Agraggator to merge files
Date Mon, 02 May 2011 07:12:01 GMT
The code can be something like this. Where we + the bodies together and use a
\n between them. But the code can be anything you like. Just set the
"result" on the IN body on the oldExchange and return it.

  public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { 
      if (newExchange == null) {
   return oldExchange;

     String oldTxt = oldExchange.getIn().getBody(String.class);
     String newTxt = newExchange.getIn().getBody(String.class);
     String body = oldTxt + "\n" + newTxt;
     // replace and return oldExchange
     return oldExchange;

Claus Ibsen
Twitter: davsclaus
Author of Camel in Action:
View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message