package camelcoredemo;


import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.impl.DefaultCamelContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by kennethfeng on 3/28/15.
 */
public class TimerMain {
    static Logger LOG = LoggerFactory.getLogger(TimerMain.class);

    public static void main(String []args) throws Exception {
        new TimerMain().run();
    }

    void run() throws Exception {
        final CamelContext camelContext = new DefaultCamelContext();

        camelContext.addRoutes(createRouteBuilder());
        camelContext.setTracing(true);
        camelContext.start();

        Runtime.getRuntime().addShutdownHook(new Thread() {
            public void run() {
                try {
                    camelContext.stop();
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            }
        });

        waitForStop();
    }

    RouteBuilder createRouteBuilder() {
        return new TimerRouteBuilder();
    }

    void waitForStop() {
        while (true) {
            try {
                Thread.sleep(Long.MAX_VALUE);
            }
            catch (InterruptedException e) {
                break;
            }
        }
    }
}

@@ -48,32 +48,62 @@
 l.CamelContext;%0A
+import org.apache.camel.Main;%0A
 import org.apach
@@ -309,16 +309,29 @@
 merMain 
+extends Main 
 %7B%0A    st
@@ -461,20 +461,16 @@
         
-new 
 TimerMai
@@ -474,137 +474,77 @@
 Main
-().run();%0A    %7D%0A%0A    void run() throws Exception %7B%0A        final CamelContext camelContext = new DefaultCamelContex
+ main = new TimerMain();%0A        main.enableHangupSuppor
 t();%0A
-%0A
         
 came
@@ -539,28 +539,20 @@
         
-camelContext
+main
 .addRout
@@ -552,17 +552,23 @@
 addRoute
-s
+Builder
 (createR
@@ -595,695 +595,117 @@
     
-camelContext.setTracing(true);%0A        camelContext.start();%0A%0A        Runtime.getRuntime().addShutdownHook(new Thread() %7B%0A            public void run() %7B%0A                try %7B%0A                    camelContext.stop();%0A                %7D catch (Exception e) %7B%0A                    throw new RuntimeException(e);%0A                %7D%0A            %7D%0A        %7D);%0A%0A        waitForStop();%0A    %7D%0A%0A    RouteBuilder createRouteBuilder() %7B%0A        return new TimerRouteBuilder();%0A    %7D%0A%0A    void waitForStop() %7B%0A        while (true) %7B%0A            try %7B%0A                Thread.sleep(Long.MAX_VALUE);%0A            %7D%0A            catch (InterruptedException e) %7B%0A                break;%0A            %7D%0A        %7D
+main.run(args);%0A    %7D%0A%0A    static RouteBuilder createRouteBuilder() %7B%0A        return new TimerRouteBuilder();
 %0A   

Use Improved Main Class