I want to start Camel from my own class called Startup because I want to
start other services as well. 
In the Startup class I do the following: 

// org.apache.camel.spring.Main
Main camelMain = new Main();
camelMain.setApplicationContextUri("../config/jms-routing.xml");

try {
            camelMain.start();
            
        } catch (Exception e) {
            
            logger.error("Error starting camel", e);
            System.exit(-1);
        }

Once the main method exits camel is stopped as well: 

2009-02-13 10:40:03,509 [                          main] TransportConnector     
       
INFO  Connector tcp Started
2009-02-13 10:40:03,510 [                          main] BrokerService          
       
INFO  ActiveMQ JMS Message Broker (localhost,
ID:semir.2e-systems.com-58933-1234518003268-0:0) started
2009-02-13 10:40:08,824 [         ActiveMQ ShutdownHook] BrokerService          
       
INFO  ActiveMQ Message Broker (localhost,
ID:semir.2e-systems.com-58933-1234518003268-0:0) is shutting down
2009-02-13 10:40:09,512 [         ActiveMQ ShutdownHook] TransportConnector     
       
INFO  Connector tcp Stopped
2009-02-13 10:40:09,578 [         ActiveMQ ShutdownHook] BrokerService          
       
INFO  ActiveMQ JMS Message Broker (localhost,
ID:semir.2e-systems.com-58933-1234518003268-0:0) stopped


If I put a thread sleep before the main method exits for 20 seconds ... then
Camel is up on 61617 for around 20 seconds. 

Am I doing something wrong ? 
Can anybody help ? 

-- 
View this message in context: 
http://www.nabble.com/Starting-camel-from-my-own-class---Camel-stops-when-main-method-stops-tp21993387s22882p21993387.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to