The Delayer is used for slowing processing of messages.
This allows you to set a fixed amount of delay between each step a message passes in the route, to better show how things is happening nice and slowly, so you are not bombarded with a zillion lines of logging output.
The delayer can be configured on two levels:
CamelContext - Globally
Route - Individually per route
Configuring using XML DSL
Just set the
delayer attribute of the
<camelContext> tag as shown below:
<camelContext id="camel" delayer="500" xmlns="http://activemq.apache.org/camel/schema/spring"> <route> <from uri="direct:start"/> <to uri="mock:result"/> </route> </camelContext>
Configuring using Java
You can enable delaying messages by setting the delay value on the
CamelContext as shown:
Configuring on route level
You can also 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.
<camelContext> <route delayer="200"> ... </route> <route> ... </route> </camelContext>
And in Java DSL: