1

I'm new to camel. I'm trying to create a small application that allows me to move a file from one location to another. I am forced to use camel for various reasons. I can execute the move but I can not make camel stop when there are no more files within the folder. I tried in several ways but without success.

Here is the code I used:

try {
   Main main = new Main();
   main.addRouteBuilder(createRouteBuilder());
   main.run();
} catch (Exception e1) {
   e1.printStackTrace();
}

protected RouteBuilder createRouteBuilder() throws Exception {
   return new RouteBuilder() {
      public void configure() throws Exception {
          from("file:./xxx").to("file:C:\\tomcat-6.0.37\\apache-tomcat-6.0.37\\yyy");   
      }
   };
}
Nopesound
  • 482
  • 1
  • 13
  • 28

1 Answers1

1

Configure your file endpoint to send an empty message when there are no more files to process. Then in your route you can detect the empty message and shut down the route following this http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html

Bilgin Ibryam
  • 3,345
  • 2
  • 19
  • 20
  • The example doesn't show how to stop the route, rather it displays how to stop the entire camel context. – rd22 Jul 18 '18 at 11:59