I am creating a basic route to copy files from one folder to another.
My ultimate goal, if to have a multiple routes in my application, and every route will be invoked as a step in batch process, one after the other. So I will have to start and stop camel context for each route.
I have written following code.
But camel context end's before completing the job.
I can't put thread sleep, as I am not sure how much time job will take.
Any help in this regard will be great help.
public class FileTransporter {
public static void main(String[] args) {
HdfsRouteBuilder1 anotherRouteBuilder =new HdfsRouteBuilder1();
CamelContext ctx = new DefaultCamelContext();
try{
ctx.addRoutes(anotherRouteBuilder);
ctx.start();
ctx.stop();
} catch(Exception e){
e.printStackTrace();
}
}//end of main method
}
public class HdfsRouteBuilder1 extends RouteBuilder{
@Override
public void configure() throws Exception {
from("file://E:/test/?noop=true")
.threads(1)
.to("file://E:/test1/");
}
}
I also tried using oncompletion() option, in route, but that also doesn't help.
Thanks