camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CyrilForce <>
Subject Manually start route in java code
Date Thu, 08 Apr 2010 07:41:25 GMT

Hi All,

I would like to know is there is any ways to start or fire the routes in
java code. As i would have a applicationContent.xml for spring webapps which
loads the camelContext with the route (disabled for autostartup).

Code as below :

1) in applicationContext

  <bean id="route" class="camelinaction.TestSpringManualStartup"/>

    <camelContext id="camel" xmlns="">
        <routeBuilder ref="route"/>

2)in route (java)

public class TestSpringManualStartup extends RouteBuilder {

	    public void configure() throws Exception {
	        // when the exchange is completed then stop the route by
	        // running this onCompletion
	        onCompletion().process(new StopRouteProcessor("manual"));

	        // ensure we only pickup one file at any given time
	            // use noAutoStartup to indicate this route should
	            // NOT be started when Camel starts
	  //          .log("Doing manual update with file ${file:name}")

	    public class StopRouteProcessor implements Processor {
	        private final String name;

	        public StopRouteProcessor(String name) {
	   = name;

	        public void process(Exchange exchange) throws Exception {



View this message in context:
Sent from the Camel Development mailing list archive at

View raw message