I've a camel route which looks like below
from("activemq:queue:upload" )
.pollEnrich().simple("file:basePath/${header.ID}?noop=true&recursive=true")
.aggregationStrategy(new ExampleAggregationStrategy())
.timeout(2000)
.toD("ftp:${header.destinationURI}")
In my file system file:basePath/${header.ID}
contains multiple folders. When above route is executed, only 1st file from the 1st folder will be copied to ftp server. Remaining folders(with subfolders) aren't getting copied to ftp server!
And ExampleAggregationStrategy()
class's aggregate()
method looks like below
@Override
public Exchange aggregate(Exchange oldExchange, Exchange newExchange) {
String destinationURI = "populatedURI";
oldExchange.setOut(newExchange.getIn());
oldExchange.getOut().setHeader("ID", oldExchange.getIn().getHeader("ID"));
oldExchange.getOut().setHeader("destinationURI", destinationURI);
oldExchange.setFromEndpoint(newExchange.getFromEndpoint());
oldExchange.setFromRouteId(newExchange.getFromRouteId());
return oldExchange;
}
I've tried setting properties and onCompletions
as well. Still no luck !
Am I missing anything in aggregationStrategy
?
How to copy all the files and folders successfully using pollEnrich
?