THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block | ||||
---|---|---|---|---|
| ||||
<bean id="myPolicy" class="com.mycompany.MyRoutePolicy"/> <route routePolicyRef="myPolicy"> <from uri="seda:foo"/> <to uri="mock:result"/> </route> |
Configuring policy sets
Available as of Camel 2.7
RoutePolicy has been further improved to allow addition of policy sets or a collection of policies that are concurrently applied on a route. The addition of policies is done as follows.
In the example below, the route testRoute has a startPolicy and throttlePolicy applied concurrently. Both policies are applied as necessary on the route.
Code Block | ||||
---|---|---|---|---|
| ||||
<bean id="date" class="org.apache.camel.routepolicy.quartz.SimpleDate"/>
<bean id="startPolicy" class="org.apache.camel.routepolicy.quartz.SimpleScheduledRoutePolicy">
<property name="routeStartDate" ref="date"/>
<property name="routeStartRepeatCount" value="1"/>
<property name="routeStartRepeatInterval" value="3000"/>
</bean>
<bean id="throttlePolicy" class="org.apache.camel.impl.ThrottlingInflightRoutePolicy">
<property name="maxInflightExchanges" value="10"/>
</bean>
<camelContext id="testRouteContext" xmlns="http://camel.apache.org/schema/spring">
<route id="testRoute" autoStartup="false" routePolicyRef="startPolicy, throttlePolicy">
<from uri="seda:foo?concurrentConsumers=20"/>
<to uri="mock:success"/>
</route>
</camelContext>
</route>
|
See Also
- Route Throttling Example for an example using this in practice with the ThrottlingInflightRoutePolicy
- ScheduledRoutePolicy for information on policy based scheduling capability for camel routes
- Architecture