2008-10-30

Camel 1.5 a nifty new feature - Delay Interceptor

It's just a matter of hours before the votes passes and Camel 1.5.0 is GA.

However this blog entry is about a new nifty feature we have added in Camel 1.5. The delay interceptor. The idea is basically to slow things down, or to be more precise to slow down the routing. Camel do this by delaying the passing of the message from node to node in the route graph.

During either development or testing you are often in a situation where you are debugging or testing an issue and you push in some messages to your ESB platform. Then they are processed but things happens so fast in modern computers that the logging out is hammering with zillions of log lines and you kinda lost the picture what happened.

So instead of having to add a lot of Thread.sleep() or .delay() (yes we also have a delayer DSL) in the route we have this light weight AOP interceptor that delays the routing for you.

To enable it in for instance the Spring DSL you set the delay attribute on the camelContext. As shown below we set a delay of 3 seconds (3000 millis).
<camelContext id="camel" delay="3000" xmlns="http://activemq.apache.org/camel/schema/spring">
...
<camelContext>
This kind of interceptor has a sister so to speak, we have the Tracer that enables logging of the exchanges that are routed. Combining these two you have a powerful combination to easily help you at runtime to investigate what is happening.

No comments: