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
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.
My code-
Main camelMain = new Main();
camelMain.enableHangupSupport();
camelMain.addRouteBuilder(getRouteBuilderLocaltoFTP());
camelMain.run();
RouteBuilder
public void configure() throws Exception {
from(<File-Path>).routeId("local-to-ftp")
.onCompletion().process(new Processor() {
@Override
public void process(Exchange exchange) throws Exception {
exchange.getContext().stop();
}
})
.toD(<FTP-Path>);
Also tried using control-Bus .toF("controlbus:route?routeId=%s&action=stop&async=true", "local-to-ftp")
But in both the cases, routes are shutting down gracefully not closing the program.
Seek help in this.