camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davsclaus <cib_re...@yahoo.dk>
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
     oldExchange.getIn().setBody(body);
     return oldExchange;
} 

-----
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
--
View this message in context: http://camel.465427.n5.nabble.com/Agraggator-to-merge-files-tp4358984p4364111.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message