Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

See the javadoc of the org.apache.camel.spi.RoutePolicy for more details.
And also the implementation of the org.apache.camel.impl.ThrottlingRoutePolicyThrottlingInflightRoutePolicy for a concrete example.

Camel provides the following policies out of the box:

  • org.apache.camel.impl.ThrottlingRoutePolicyThrottlingInflightRoutePolicy - a throttling based policy that automatic suspends/resumes route(s) based on metrics from the current in flight exchanges. You can use this to dynamic throttle e.g. a JMS consumer to avoid it consuming too fast.
Tip
titleSuspendableService

If you want to dynamic suspend/resume routes as the org.apache.camel.impl.ThrottlingRoutePolicy does then its advised to use org.apache.camel.SuspendableService as it allows for fine grained suspend and resume operations. And use the org.apache.camel.util.ServiceHelper to aid when invoking these operations as it support fallback for regular org.apache.camel.Service instances.

...

ThrottlingInflightRoutePolicy

The throttling inflight route policy has the following options:

Option

Default

Description

scope

Route

A scope for either Route or Context which defines if the current number of inflight exchanges is context based or for that particular route.

maxInflightExchanges

1000

The maximum threshold when the throttling will start to suspend the route if the current number of inlfight exchanges is higher than this value.

resumePercentOfMax

70

A percentage 0..100 which defines when the throttling should resume again in case it has been suspended.

loggingLevel

INFO

The logging level used for logging the throttling activity.

logger

ThrottlingRoutePolicy ThrottlingInflightRoutePolicy

The logger category.

Configuring policy

...