Hi guys, I got another question here. I start my camelContext in the main(), then in the route, I stop the camelContext in a Processor. Now I can see the camelContext is shutdown gracefully. However, the Java application is still running. My question is that whether there is a way to exit the Java main() automatically after the camelContext is shutdown.
public static void main(String[] args) throws Exception { String filename = "META-INF/spring/testingcontext.xml"; Main main = new Main(); main.setApplicationContextUri(filename); main.enableHangupSupport(); main.run(); } public class DownloadLogger implements Processor { public void process(final Exchange exchange) throws Exception { System.out.println("We just downloaded: " + exchange.getIn().getHeader("CamelFileName")); Thread stop = new Thread() { @Override public void run() { try { //exchange.getContext().stopRoute("myRoute"); exchange.getContext().getShutdownStrategy().setTimeout(5); exchange.getContext().stop(); } catch (Exception e) { // ignore } } }; stop.start(); System.out.println("after camel context stop"); } } I thansk in advance! Lei -- View this message in context: http://camel.465427.n5.nabble.com/After-camelContext-shutdown-is-any-way-to-exit-the-Java-main-method-tp5735993.html Sent from the Camel - Users mailing list archive at Nabble.com.