Camel 2.1 - RoutePolicy a new feature

Apache Camel 2.1 is coming along really nice. Just got one of the last features in today, but that feature is for another blog post.

In Camel 2.1 we have introduced the notion of a route policy. It is used for controlling routes at runtime in a dynamic fashion. You assign a route policy to one or multiple routes which then at runtime will invoke a callback on the RoutePolicy interface. This interface provides hook to control the route such as suspending or resuming it. However you can implement the logic of choice.

By default we ship with a ThrottlingInflightRoutePolicy which is a dynamic throttler based on the current number of inflight exchanges. So you can configure it to throttle at thresholds such at 500 in flight exchanges and a low water mark at 40% etc.

To see all this in action we have added a new Route Throttling Example you can try out and learn how to use this in your projects.

And the ThrottlingInflightRoutePolicy is also JMX enabled so you can change its thresholds at runtime as well. Talk about dynamic :)

There are much more details on those links in this blog. And I have to advert for my book - Camel in Action, where we will provide more details of this feature.

No comments: