(Sorry if this message is a duplicate but it seems it wasn't sent properly
last time, so I post it using Nabble instead of email).
Hi,
I have a standalone application that uses Spring and Camel.
As suggested in the Camel in Action book, I do this in order to launch the
application and make it lasts until I hit Ctrl+C :
public class MainSimulator {
public static void main(String[] args) throws Exception {
Main main = new Main();
AbstractApplicationContext ctx = new ClassPathXmlApplicationContext(
"META-INF/spring/activity-simulator-context.xml",
"META-INF/spring/application-context.xml"
);
main.setApplicationContext(ctx);
main.enableHangupSupport();
main.start(true);
}
}
The camel context consists of :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring-2.6.0.xsd">
<bean id="simulator"
class="com.prg.babylon.dashboard.simulation.ActivitySimulator"/>
<bean id="dataOutputter"
class="com.prg.babylon.dashboard.simulation.ChannelDataOutputter"/>
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="timer://simulator"/>
<bean ref="simulator" method="fillData"/>
<bean ref="dataOutputter" method="output"/>
</route>
</camelContext>
</beans>
The application starts fine but directly stops afterwards :
mvn clean compile exec:java
-Dexec.mainClass=com.prg.babylon.dashboard.simulation.MainSimulator
[INFO] Scanning for projects...
[...]
Feb 1, 2011 4:21:21 PM org.apache.camel.impl.DefaultCamelContext
doStartOrResumeRouteConsumers
INFO: Route: route1 started and consuming from: Endpoint[timer://simulator]
Feb 1, 2011 4:21:21 PM org.apache.camel.impl.DefaultCamelContext start
INFO: Total 1 routes, of which 1 is started.
Feb 1, 2011 4:21:21 PM org.apache.camel.impl.DefaultCamelContext start
INFO: Apache Camel 2.6.0 (CamelContext: camel) started in 1.687 seconds
Feb 1, 2011 4:21:21 PM org.apache.camel.impl.MainSupport doStart
INFO: Apache Camel 2.6.0 starting
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 8.028s
[INFO] Finished at: Tue Feb 01 16:21:21 CET 2011
[INFO] Final Memory: 14M/166M
[INFO]
------------------------------------------------------------------------
So, my question is : what did I do wrong ?
Regards.
--
View this message in context:
http://camel.465427.n5.nabble.com/Camel-startup-tp3367829p3367829.html
Sent from the Camel - Users mailing list archive at Nabble.com.