title: Camel Main to process big file and stop the route and exit from JVM
body: <p>I have a requirement to process the big file using these 2 case
  (1) Pull from file directory and push to FTP
  (2) Pull from one FTP and push to another FTP</p>
  
  <p>I am creating a java maven dependency project which use camel components to process above use-case of file transfer, so I decided to use org.apache.camel.main.Main class to start my route, but the problem is my program is not getting closed even after file is processed successfully. Somewhere I read that using "System.exit()" would solve the problem but still problem exists.</p>
  
  <p>My code-</p>
  
  <pre><code>Main camelMain = new Main();
  camelMain.enableHangupSupport();
  camelMain.addRouteBuilder(getRouteBuilderLocaltoFTP());
  camelMain.run();
  </code></pre>
  
  <p>RouteBuilder</p>
  
  <pre><code>public void configure() throws Exception { 
      from(&lt;File-Path&gt;).routeId("local-to-ftp")
      .onCompletion().process(new Processor() {
                  @Override
                  public void process(Exchange exchange) throws Exception {
                      exchange.getContext().stop();       
                  }
              })
              .toD(&lt;FTP-Path&gt;); 
  </code></pre>
  
  <p>Also tried using control-Bus
  .toF("controlbus:route?routeId=%s&amp;action=stop&amp;async=true", "local-to-ftp")</p>
  
  <p>But in both the cases, routes are shutting down gracefully not closing the program.</p>
  
  <p>Seek help in this.</p>