Hi there,
I continue to explore Camel, and now I would like to aggregate all
text/xml files in a folder in one unique file in another folder.
I try many things, and think arrive to something that "should work"
;)... but it don't : the aggregated file is not created.
Do you see any newbie mistake here ? TIA !
Here come my route :
from("file:dataSet?noop=true")
.aggregate(header("yes"), new XMLAggregateStrategy())
.completionPredicate(property("CamelBatchComplete").isEqualTo(true))
.to("file:resultSet?fileName=resultfile.xml");
And my XMLAggregateStrategy :
(just copy-paste all text for now, see how to deal with part-of xml
message later).
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
Message newIn = newExchange.getIn();
String oldBody = oldExchange.getIn().getBody(String.class);
String newBody = newIn.getBody(String.class);
newIn.setBody(oldBody + newBody);
return newExchange;
}
++