...
- auto startup
- order of starting routes
Configuring whether Camel should be auto started or not in XML DSL
The old option shouldStartContext
have been removed and replaced with this new autoStartup
option instead. What it allows is to configure Camel to not auto start when Spring starts.
...
Code Block |
---|
ApplicationContext ac = ... SpringCamelContext camel = (SpringCamelContext) ac.getBean("myCamel"); // now start Camel manually camel.start(); |
Configuring whether a route should be started or not in XML DSL
You can use the autoStartup
option to configure if a given route should be started when Camel starts. By default a route is auto started.
You can disable or enable it as follows:
In XML DSL you define it as follows:
Code Block | ||||
---|---|---|---|---|
| ||||
<route autoStartup="false"> <from uri="activemq:queue:special"/> <to uri="file://backup"/> </route> |
And to explicit state it should be started
Code Block | ||||
---|---|---|---|---|
| ||||
<route autoStartup="true">
<from uri="activemq:queue:special"/>
<to uri="file://backup"/>
</route>
|
Configuring whether a route should be started or not in Java DSL
You can use the autoStartup
option to configure if a given route should be started when Camel starts. By default a route is auto started.
You can disable or enable it as follows:
Code Block |
---|
from("activemq:queue:special").noAutoStartup().to("file://backup");
|
Configuring whether a route should be started or not, using a boolean or String, in Java DSL
Available as of Camel 2.9
To startup based on a boolean, String or Property, do one of the following:
Code Block |
---|
boolean startupRoute = true;
from("activemq:queue:special").autoStartup(startupRoute).to("file://backup");
...
String startupRoute = "true";
from("activemq:queue:special").autoStartup(startupRoute).to("file://backup");
...
from("activemq:queue:special").autoStartup("{{startupRouteProperty}}").to("file://backup");
|
In XML DSL you define it as follows:
...
<route autoStartup="false">
<from uri="activemq:queue:special"/>
<to uri="file://backup"/>
</route>
And to explicit state it should be started
Code Block | ||
---|---|---|
xml | xml |
<route autoStartup="true">
<from uri="activemq:queue:special"/>
<to uri="file://backup"/>
</route>
|
Configuring starting order for routes
...