I have a globally defined FTP Camel route. It is started from another route:
exchange.getContext().startRoute("downloadRoute");
and stopped in another thread, as described here:
.process(new Processor() {
Thread stop;
@Override
public void process(final Exchange exchange) throws Exception {
stop = new Thread() {
@Override
public void run() {
try {
log.info("Stopping route");
exchange.getContext().stopRoute("downloadRoute");
} catch (Exception e) {
} finally {
latch.countDown();
}
}
};
stop.start();
}
})
It works fine. Now I want to start this route again. Say I added new files to the folder and want to download them again, or re-download downloaded files.
So I start this route again with the same command, but it doesn't download files - it simply doesn't see them, since they marked as downloaded somewhere in the route. Whereas if I remove this route from camel context then add it again and start - it works - it downloads files again.
So the question is how to reuse (start-stop-start) an existing route so that it starts as a new one?