THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
- using Java system property
camel.delay=value
where value is the fixed delay in millis. - setting the delay attribute in the spring camelContext tag.
- adding the delay interceptor to the CamelContext in Java code.
Configuring
...
You can set the delay as a JVM system property as:
Code Block |
---|
-Dcamel.delay=500
|
Where we set the delay to 500 millis.
Configuring using Spring
Just set the delay attribute of the camelContext tag as shown below:
Code Block | ||||
---|---|---|---|---|
| ||||
<camelContext id="camel" delaydelayer="500" xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="direct:start"/> <to uri="mock:result"/> </route> </camelContext> |
...
Code Block | ||||
---|---|---|---|---|
| ||||
public void configure() throws Exception {
// add the delay interceptor to delay each step 200 millis
getContext().addInterceptStrategy(new Delayer(200));
... // regular routes here
}
|
In Camel 2.0 its a bit easier as you can just do
Code Block |
---|
getContext().setDelayer(200);
|
Granularity
In Camel 2.0 you can configure it on both camel context and per route as you like. Per route will override the camel context setting.
For example the route below is only the first route that has a delayer with 200 millis.
Code Block |
---|
<camelContext ...>
<route delayer="200">
...
</route>
<route>
...
</route>
</camelContext>
|