There is a special completion for batch consumer. Use that instead of the completion predicate. http://camel.apache.org/aggregator2
On Tue, Dec 14, 2010 at 2:28 PM, florent andré <[email protected]> wrote: > 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; > } > > > ++ > -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
