[CONF] Apache Camel > RoutePolicy

2014-08-16 Thread Claus Ibsen (Confluence)














  


Claus Ibsen edited the page:
 


RoutePolicy   






...

 Route Throttling Example for an example using this in practice with the ThrottlingInflightRoutePolicy
 ScheduledRoutePolicy for information on policy based scheduling capability for camel routes
 MetricsRoutePolicyFactory for information on a policy using the metrics component to expose route statistics using the metrics library. 
 Architecture 







 View Online  · Like  · View Changes  
 Stop watching space  · Manage Notifications  


 


 


  This message was sent by Atlassian Confluence 5.0.3, Team Collaboration Software  






[CONF] Apache Camel > RoutePolicy

2014-08-15 Thread Claus Ibsen (Confluence)














  


Claus Ibsen edited the page:
 


RoutePolicy   






...
You configure the route policy as follows from Java DSL, using the routePolicy method:



 Code Block




 
 RoutePolicy myPolicy = new MyRoutePolicy();
  from("seda:foo").routePolicy(myPolicy).to("mock:result");
 



In Spring XML its a bit different as follows using the routePolicyRef attribute:



 Code Block









xml


 




 
 

   
   
   
   
 



...
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









[CONF] Apache Camel > RoutePolicy

2011-12-08 Thread confluence







RoutePolicy
Page edited by Claus Ibsen


 Changes (1)
 




...
There are these callbacks invoked - {{onInit}} *Camel 2.3* 
- {{onRemove}} *Camel 2.9* - {{onStart}} *Camel 2.9* - {{onStop}} *Camel 2.9* - {{onSuspend}} *Camel 2.9* - {{onResume}} *Camel 2.9* 
- {{onExchangeBegin}} - {{onExchangeDone}} 
...


Full Content

RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are these callbacks invoked

	onInit Camel 2.3
	onRemove Camel 2.9
	onStart Camel 2.9
	onStop Camel 2.9
	onSuspend Camel 2.9
	onResume Camel 2.9
	onExchangeBegin
	onExchangeDone



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

Camel provides the following policies out of the box:

	org.apache.camel.impl.ThrottlingInflightRoutePolicy - 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.



As of Camel 2.5, Camel also provides an ability to schedule routes to be activated, de-activated, suspended and/or resumed at certain times during the day using a ScheduledRoutePolicy (offered via the camel-quartz component). 


SuspendableServiceIf 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 ThrottlingInflightRoutePolicy is triggered when an Exchange is complete, which means that it requires at least one Exchange to be complete before it works. 

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 
 ThrottlingInflightRoutePolicy 
 The logger category. 





ThrottlingInflightRoutePolicy compared to the Throttler EIPThe ThrottlingInflightRoutePolicy compared to Throttler is that it does not block during throttling. It does throttling that is approximate based, meaning that its more coarse grained and not explicit precise as the Throttler. The Throttler can be much more accurate and only allow a specific number of messages being passed per a given time unit. Also the ThrottlingInflightRoutePolicy is based its metrics on number of inflight exchanges where as Throttler is based on number of messages per time unit.

ScheduledRoutePolicy (Simple and Cron based) using camel Quartz

For more details check out the following links

Configuring policy

You configure the route policy as follows from Java DSL, using the routePolicy method:


  RoutePolicy myPolicy = new MyRoutePolicy();
  from("seda:foo").routePolicy(myPolicy).to("mock:result");



In Spring XML its a bit different as follows using the routePolicyRef attribute:


   "myPolicy" class="com.mycompany.MyRoutePolicy"/>
   
   "myPolicy">
   "seda:foo"/>
   "mock:result"/>
   



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.


   "date" class="org.apache.camel.routepolicy.quartz.SimpleDate"/>

"startPolicy" class="org.apache.camel.routepolicy.quart

[CONF] Apache Camel > RoutePolicy

2011-11-16 Thread confluence







RoutePolicy
Page edited by Bilgin Ibryam


 Changes (1)
 




...
*Available as of Camel 2.1*  
A route policy {{org.apache.camel.spi.RoutePolicy}} is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies is can support any kind of use cases. 
 h3. How it works 
...


Full Content

RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are these callbacks invoked

	onInit Camel 2.3
	onExchangeBegin
	onExchangeDone



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

Camel provides the following policies out of the box:

	org.apache.camel.impl.ThrottlingInflightRoutePolicy - 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.



As of Camel 2.5, Camel also provides an ability to schedule routes to be activated, de-activated, suspended and/or resumed at certain times during the day using a ScheduledRoutePolicy (offered via the camel-quartz component). 


SuspendableServiceIf 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 ThrottlingInflightRoutePolicy is triggered when an Exchange is complete, which means that it requires at least one Exchange to be complete before it works. 

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 
 ThrottlingInflightRoutePolicy 
 The logger category. 





ThrottlingInflightRoutePolicy compared to the Throttler EIPThe ThrottlingInflightRoutePolicy compared to Throttler is that it does not block during throttling. It does throttling that is approximate based, meaning that its more coarse grained and not explicit precise as the Throttler. The Throttler can be much more accurate and only allow a specific number of messages being passed per a given time unit. Also the ThrottlingInflightRoutePolicy is based its metrics on number of inflight exchanges where as Throttler is based on number of messages per time unit.

ScheduledRoutePolicy (Simple and Cron based) using camel Quartz

For more details check out the following links

Configuring policy

You configure the route policy as follows from Java DSL, using the routePolicy method:


  RoutePolicy myPolicy = new MyRoutePolicy();
  from("seda:foo").routePolicy(myPolicy).to("mock:result");



In Spring XML its a bit different as follows using the routePolicyRef attribute:


   "myPolicy" class="com.mycompany.MyRoutePolicy"/>
   
   "myPolicy">
   "seda:foo"/>
   "mock:result"/>
   



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.


   "date" class="org.apache.camel.routepolicy.quartz.SimpleDate"/>

"startPolicy" class="org.apache.camel.routepolicy.quartz.SimpleScheduledRoutePolicy">
	"routeStartDate

[CONF] Apache Camel > RoutePolicy

2011-02-01 Thread confluence







RoutePolicy
Page edited by Ashwin Karpe


 Changes (1)
 




...
  
uri="mock:success"/> uri="mock:result"/> 
  
...


Full Content

RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies is can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are these callbacks invoked

	onInit Camel 2.3
	onExchangeBegin
	onExchangeDone



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

Camel provides the following policies out of the box:

	org.apache.camel.impl.ThrottlingInflightRoutePolicy - 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.



As of Camel 2.5, Camel also provides an ability to schedule routes to be activated, de-activated, suspended and/or resumed at certain times during the day using a ScheduledRoutePolicy (offered via the camel-quartz component). 


SuspendableServiceIf 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 ThrottlingInflightRoutePolicy is triggered when an Exchange is complete, which means that it requires at least one Exchange to be complete before it works. 

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 
 ThrottlingInflightRoutePolicy 
 The logger category. 





ThrottlingInflightRoutePolicy compared to the Throttler EIPThe ThrottlingInflightRoutePolicy compared to Throttler is that it does not block during throttling. It does throttling that is approximate based, meaning that its more coarse grained and not explicit precise as the Throttler. The Throttler can be much more accurate and only allow a specific number of messages being passed per a given time unit. Also the ThrottlingInflightRoutePolicy is based its metrics on number of inflight exchanges where as Throttler is based on number of messages per time unit.

ScheduledRoutePolicy (Simple and Cron based) using camel Quartz

For more details check out the following links

Configuring policy

You configure the route policy as follows from Java DSL, using the routePolicy method:


  RoutePolicy myPolicy = new MyRoutePolicy();
  from("seda:foo").routePolicy(myPolicy).to("mock:result");



In Spring XML its a bit different as follows using the routePolicyRef attribute:


   "myPolicy" class="com.mycompany.MyRoutePolicy"/>
   
   "myPolicy">
   "seda:foo"/>
   "mock:result"/>
   



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.


   "date" class="org.apache.camel.routepolicy.quartz.SimpleDate"/>

"startPolicy" class="org.apache.camel.routepolicy.quartz.SimpleScheduledRoutePolicy">
	"routeStartDate" ref="date"/>
	"routeStartRepeatCount" value="1"/>
	"routeStartRepeatInterval" value="3000"/>	


"throttlePolicy" class="org.apache.camel.impl.ThrottlingInflightRoutePolicy">
 

[CONF] Apache Camel > RoutePolicy

2011-02-01 Thread confluence







RoutePolicy
Page edited by Ashwin Karpe


 Changes (1)
 




...
{code}  
h3. 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:xml}   	 	 				 	{code}  
h3. See Also - [Route Throttling Example] for an example using this in practice with the ThrottlingInflightRoutePolicy 
...


Full Content

RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies is can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are these callbacks invoked

	onInit Camel 2.3
	onExchangeBegin
	onExchangeDone



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

Camel provides the following policies out of the box:

	org.apache.camel.impl.ThrottlingInflightRoutePolicy - 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.



As of Camel 2.5, Camel also provides an ability to schedule routes to be activated, de-activated, suspended and/or resumed at certain times during the day using a ScheduledRoutePolicy (offered via the camel-quartz component). 


SuspendableServiceIf 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 ThrottlingInflightRoutePolicy is triggered when an Exchange is complete, which means that it requires at least one Exchange to be complete before it works. 

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 
 ThrottlingInflightRoutePolicy 
 The logger category. 





ThrottlingInflightRoutePolicy compared to the Throttler EIPThe ThrottlingInflightRoutePolicy compared to Throttler is that it does not block during throttling. It does throttling that is approximate based, meaning that its more coarse grained and not explicit precise as the Throttler. The Throttler can be much more accurate and only allow a specific number of messages being passed per a given time unit. Also the ThrottlingInflightRoutePolicy is based its metrics on number of inflight exchanges where as Throttler is based on number of messages per time unit.

ScheduledRoutePolicy (Simple and Cron based) using camel Quartz

For more details check out the following links

Configuring policy

You configure the route policy as follows from Java DSL, using the routePolicy method:


  RoutePolicy myPolicy = new MyRoutePolicy();
  from("seda:foo").routePolicy(myPolicy).to("mock:result");



In Spring XML its a bit different as follows using the routePolicyRef attribute:


   "myPolicy" class="com.mycompany.MyRoutePolicy"/>
   
   "myPolicy">
   "seda:foo"/>
   "mock:result"/>
   



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

[CONF] Apache Camel > RoutePolicy

2010-12-02 Thread confluence







RoutePolicy
Page edited by Richard Kettelerij


Comment:
Minor change: moved info block under proper header


 Changes (2)
 



...
| logger | ThrottlingInflightRoutePolicy | The logger category. |  
h4. ScheduledRoutePolicy (Simple and Cron based) using camel Quartz  For more details check out the following links  
{info:title=ThrottlingInflightRoutePolicy compared to the [Throttler] EIP} The {{ThrottlingInflightRoutePolicy}} compared to [Throttler] is that it does *not* block during throttling. It does throttling that is approximate based, meaning that its more coarse grained and not explicit precise as the [Throttler]. The [Throttler] can be much more accurate and only allow a specific number of messages being passed per a given time unit. Also the {{ThrottlingInflightRoutePolicy}} is based its metrics on number of inflight exchanges where as [Throttler] is based on number of messages per time unit. {info}  
h4. ScheduledRoutePolicy (Simple and Cron based) using camel Quartz  For more details check out the following links  
h3. Configuring policy  
...

Full Content

RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies is can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are these callbacks invoked

	onInit Camel 2.3
	onExchangeBegin
	onExchangeDone



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

Camel provides the following policies out of the box:

	org.apache.camel.impl.ThrottlingInflightRoutePolicy - 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.



As of Camel 2.5, Camel also provides an ability to schedule routes to be activated, de-activated, suspended and/or resumed at certain times during the day using a ScheduledRoutePolicy (offered via the camel-quartz component). 


SuspendableServiceIf 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 ThrottlingInflightRoutePolicy is triggered when an Exchange is complete, which means that it requires at least one Exchange to be complete before it works. 

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 
 ThrottlingInflightRoutePolicy 
 The logger category. 





ThrottlingInflightRoutePolicy compared to the Throttler EIPThe ThrottlingInflightRoutePolicy compared to Throttler is that it does not block during throttling. It does throttling that is approximate based, meaning that its more coarse grained and not explicit precise as the Throttler. The Throttler can be much more accurate and only allow a specific number of messages being passed per a given time unit. Also the ThrottlingInflightRoutePolicy is based its metrics on number of inflight exchanges where as Throttler is based on number of messages per time unit.

ScheduledRoutePolicy (Simple and Cron based) using camel Quartz

For more details check out the following links

Configuring policy

You configure the route policy as follows from Java DSL, using the routePolicy method:


  RoutePolicy myPolicy = new MyRoutePolicy();
  from("seda:foo").routePolicy(myPolicy).to("mock:result");



In Spring XML its a bit dif

[CONF] Apache Camel > RoutePolicy

2010-09-30 Thread confluence







RoutePolicy
Page edited by Ashwin Karpe


 Changes (1)
 



...
h3. 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] 

Full Content

RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies is can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are these callbacks invoked

	onInit Camel 2.3
	onExchangeBegin
	onExchangeDone



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

Camel provides the following policies out of the box:

	org.apache.camel.impl.ThrottlingInflightRoutePolicy - 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.



As of Camel 2.5, Camel also provides an ability to schedule routes to be activated, de-activated, suspended and/or resumed at certain times during the day using a ScheduledRoutePolicy (offered via the camel-quartz component). 


SuspendableServiceIf 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 ThrottlingInflightRoutePolicy is triggered when an Exchange is complete, which means that it requires at least one Exchange to be complete before it works. 

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 
 ThrottlingInflightRoutePolicy 
 The logger category. 





ScheduledRoutePolicy (Simple and Cron based) using camel Quartz

For more details check out the following links

ThrottlingInflightRoutePolicy compared to the Throttler EIPThe ThrottlingInflightRoutePolicy compared to Throttler is that it does not block during throttling. It does throttling that is approximate based, meaning that its more coarse grained and not explicit precise as the Throttler. The Throttler can be much more accurate and only allow a specific number of messages being passed per a given time unit. Also the ThrottlingInflightRoutePolicy is based its metrics on number of inflight exchanges where as Throttler is based on number of messages per time unit.

Configuring policy

You configure the route policy as follows from Java DSL, using the routePolicy method:


  RoutePolicy myPolicy = new MyRoutePolicy();
  from("seda:foo").routePolicy(myPolicy).to("mock:result");



In Spring XML its a bit different as follows using the routePolicyRef attribute:


   "myPolicy" class="com.mycompany.MyRoutePolicy"/>
   
   "myPolicy">
   "seda:foo"/>
   "mock:result"/>
   



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





Change Notification Preferences

View Online
|
View Changes
|
Add Comment









[CONF] Apache Camel > RoutePolicy

2010-09-30 Thread confluence







RoutePolicy
Page edited by Ashwin Karpe


 Changes (2)
 



...
- {{org.apache.camel.impl.ThrottlingInflightRoutePolicy}} - 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.  
As of *Camel 2.5*, Camel also provides an ability to schedule routes to be activated, de-activated, suspended and/or resumed at certain times during the day using a [ScheduledRoutePolicy] (offered via the [camel-quartz|http://camel.apache.org/quartz.html] component). For more details please check out the link below 
[ScheduledRoutePolicy] 
  
...

Full Content

RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies is can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are these callbacks invoked

	onInit Camel 2.3
	onExchangeBegin
	onExchangeDone



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

Camel provides the following policies out of the box:

	org.apache.camel.impl.ThrottlingInflightRoutePolicy - 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.



As of Camel 2.5, Camel also provides an ability to schedule routes to be activated, de-activated, suspended and/or resumed at certain times during the day using a ScheduledRoutePolicy (offered via the camel-quartz component). 


SuspendableServiceIf 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 ThrottlingInflightRoutePolicy is triggered when an Exchange is complete, which means that it requires at least one Exchange to be complete before it works. 

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 
 ThrottlingInflightRoutePolicy 
 The logger category. 





ScheduledRoutePolicy (Simple and Cron based) using camel Quartz

For more details check out the following links

ThrottlingInflightRoutePolicy compared to the Throttler EIPThe ThrottlingInflightRoutePolicy compared to Throttler is that it does not block during throttling. It does throttling that is approximate based, meaning that its more coarse grained and not explicit precise as the Throttler. The Throttler can be much more accurate and only allow a specific number of messages being passed per a given time unit. Also the ThrottlingInflightRoutePolicy is based its metrics on number of inflight exchanges where as Throttler is based on number of messages per time unit.

Configuring policy

You configure the route policy as follows from Java DSL, using the routePolicy method:


  RoutePolicy myPolicy = new MyRoutePolicy();
  from("seda:foo").routePolicy(myPolicy).to("mock:result");



In Spring XML its a bit different as follows using the routePolicyRef attribute:


   "myPolicy" class="com.mycompany.MyRoutePolicy"/>
   
   "myPolicy">
   "seda:foo"/>
   "mock:result"/>
   



See Also

	Route Throttling Example for an example using this in practice with the ThrottlingInflightRoutePolicy
	Architecture





Change Notification Preferences

View Online
|
View

[CONF] Apache Camel > RoutePolicy

2010-09-30 Thread confluence







RoutePolicy
Page edited by Ashwin Karpe


 Changes (3)
 



...
- {{org.apache.camel.impl.ThrottlingInflightRoutePolicy}} - 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.  
As of *Camel 2.5*, Camel also provides an ability to schedule routes to be activated, de-activated, suspended and/or resumed at certain times during the day using a ScheduledRoutePolicy (offered via the [camel-quartz|http://camel.apache.org/quartz.html] component). For more details please check out the link below [ScheduledRoutePolicy]  
{tip:title=SuspendableService} 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. 
...
| logger | ThrottlingInflightRoutePolicy | The logger category. |  
h4. ScheduledRoutePolicy (Simple and Cron based) using camel Quartz 
 
For more details check out the following links  
{info:title=ThrottlingInflightRoutePolicy compared to the [Throttler] EIP} The {{ThrottlingInflightRoutePolicy}} compared to [Throttler] is that it does *not* block during throttling. It does throttling that is approximate based, meaning that its more coarse grained and not explicit precise as the [Throttler]. The [Throttler] can be much more accurate and only allow a specific number of messages being passed per a given time unit. Also the {{ThrottlingInflightRoutePolicy}} is based its metrics on number of inflight exchanges where as [Throttler] is based on number of messages per time unit. 
...

Full Content

RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies is can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are these callbacks invoked

	onInit Camel 2.3
	onExchangeBegin
	onExchangeDone



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

Camel provides the following policies out of the box:

	org.apache.camel.impl.ThrottlingInflightRoutePolicy - 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.



As of Camel 2.5, Camel also provides an ability to schedule routes to be activated, de-activated, suspended and/or resumed at certain times during the day using a ScheduledRoutePolicy (offered via the camel-quartz component). For more details please check out the link below
ScheduledRoutePolicy

SuspendableServiceIf 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 ThrottlingInflightRoutePolicy is triggered when an Exchange is complete, which means that it requires at least one Exchange to be complete before it works. 

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 
 ThrottlingInflightRoutePolicy 
 The logger category. 




[CONF] Apache Camel > RoutePolicy

2010-09-30 Thread confluence







RoutePolicy
Page edited by Ashwin Karpe


 Changes (3)
 



...
- {{org.apache.camel.impl.ThrottlingInflightRoutePolicy}} - 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.  
As of *Camel 2.5*, Camel also provides an ability to schedule routes to be activated, de-activated, suspended and/or resumed at certain times during the day using a ScheduledRoutePolicy (offered via the [camel-quartz|http://camel.apache.org/quartz.html] component). For more details please check out the link below [ScheduledRoutePolicy]  
{tip:title=SuspendableService} 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. 
...
| logger | ThrottlingInflightRoutePolicy | The logger category. |  
h4. ScheduledRoutePolicy (Simple and Cron based) using camel Quartz 
 
For more details check out the following links  
{info:title=ThrottlingInflightRoutePolicy compared to the [Throttler] EIP} The {{ThrottlingInflightRoutePolicy}} compared to [Throttler] is that it does *not* block during throttling. It does throttling that is approximate based, meaning that its more coarse grained and not explicit precise as the [Throttler]. The [Throttler] can be much more accurate and only allow a specific number of messages being passed per a given time unit. Also the {{ThrottlingInflightRoutePolicy}} is based its metrics on number of inflight exchanges where as [Throttler] is based on number of messages per time unit. 
...

Full Content

RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies is can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are these callbacks invoked

	onInit Camel 2.3
	onExchangeBegin
	onExchangeDone



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

Camel provides the following policies out of the box:

	org.apache.camel.impl.ThrottlingInflightRoutePolicy - 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.



As of Camel 2.5, Camel also provides an ability to schedule routes to be activated, de-activated, suspended and/or resumed at certain times during the day using a ScheduledRoutePolicy (offered via the camel-quartz component). For more details please check out the link below
ScheduledRoutePolicy

SuspendableServiceIf 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 ThrottlingInflightRoutePolicy is triggered when an Exchange is complete, which means that it requires at least one Exchange to be complete before it works. 

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 
 ThrottlingInflightRoutePolicy 
 The logger category. 




[CONF] Apache Camel > RoutePolicy

2009-12-31 Thread confluence







 RoutePolicy
 Page edited by Claus Ibsen

 
  
 
 RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies is can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are two callbacks invoked

	onExchangeBegin
	onExchangeDone



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

Camel provides the following policies out of the box:

	org.apache.camel.impl.ThrottlingInflightRoutePolicy - 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.



SuspendableServiceIf 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 ThrottlingInflightRoutePolicy is triggered when an Exchange is complete, which means that it requires at least one Exchange to be complete before it works. 

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 
 ThrottlingInflightRoutePolicy 
 The logger category. 




ThrottlingInflightRoutePolicy compared to the Throttler EIPThe ThrottlingInflightRoutePolicy compared to Throttler is that it does not block during throttling. It does throttling that is approximate based, meaning that its more coarse grained and not explicit precise as the Throttler. The Throttler can be much more accurate and only allow a specific number of messages being passed per a given time unit. Also the ThrottlingInflightRoutePolicy is based its metrics on number of inflight exchanges where as Throttler is based on number of messages per time unit.

Configuring policy

You configure the route policy as follows from Java DSL, using the routePolicy method:


  RoutePolicy myPolicy = new MyRoutePolicy();
  from("seda:foo").routePolicy(myPolicy).to("mock:result");



In Spring XML its a bit different as follows using the routePolicyRef attribute:


   "myPolicy" class="com.mycompany.MyRoutePolicy"/>
   
   "myPolicy">
   "seda:foo"/>
   "mock:result"/>
   



See Also

	Route Throttling Example for an example using this in practice with the ThrottlingInflightRoutePolicy
	Architecture


 
 
   
Change Notification Preferences
   

   View Online
   |
   View Change
  |
   Add Comment









[CONF] Apache Camel > RoutePolicy

2009-11-03 Thread confluence







 RoutePolicy
 Page edited by Claus Ibsen

 
  
 
 RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies is can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are two callbacks invoked

	onExchangeBegin
	onExchangeDone



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

Camel provides the following policies out of the box:

	org.apache.camel.impl.ThrottlingInflightRoutePolicy - 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.



SuspendableServiceIf 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
ThrottlingInflightRoutePolicy compared to the Throttler EIPThe ThrottlingInflightRoutePolicy compared to Throttler is that it does not block during throttling. It does throttling that is approximate based, meaning that its more coarse grained and not explicit precise as the Throttler. The Throttler can be much more accurate and only allow a specific number of messages being passed per a given time unit. Also the ThrottlingInflightRoutePolicy is based its metrics on number of inflight exchanges where as Throttler is based on number of messages per time unit.

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 
 ThrottlingInflightRoutePolicy 
 The logger category. 



Configuring policy

You configure the route policy as follows from Java DSL, using the routePolicy method:


  RoutePolicy myPolicy = new MyRoutePolicy();
  from("seda:foo").routePolicy(myPolicy).to("mock:result");



In Spring XML its a bit different as follows using the routePolicyRef attribute:


   "myPolicy" class="com.mycompany.MyRoutePolicy"/>
   
   "myPolicy">
   "seda:foo"/>
   "mock:result"/>
   



See Also

	Route Throttling Example for an example using this in practice with the ThrottlingInflightRoutePolicy
	Architecture


 
 
   
Change Notification Preferences
   

   View Online
   |
   View Change
  |
   Add Comment









[CONF] Apache Camel > RoutePolicy

2009-11-02 Thread confluence







 RoutePolicy
 Page edited by Claus Ibsen

 
  
 
 RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies is can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are two callbacks invoked

	onExchangeBegin
	onExchangeDone



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

Camel provides the following policies out of the box:

	org.apache.camel.impl.ThrottlingRoutePolicy - 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.



SuspendableServiceIf 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.

ThrottlingRoutePolicy
The throttling 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 
 The logger category. 



Configuring policy

You configure the route policy as follows from Java DSL, using the routePolicy method:


  RoutePolicy myPolicy = new MyRoutePolicy();
  from("seda:foo").routePolicy(myPolicy).to("mock:result");



In Spring XML its a bit different as follows using the routePolicyRef attribute:


   "myPolicy" class="com.mycompany.MyRoutePolicy"/>
   
   "myPolicy">
   "seda:foo"/>
   "mock:result"/>
   



See Also

	Route Throttling Example for an example using this in practice
	Architecture


 
 
   
Change Notification Preferences
   

   View Online
   |
   View Change
  |
   Add Comment









[CONF] Apache Camel > RoutePolicy

2009-11-02 Thread confluence







 RoutePolicy
 Page edited by Claus Ibsen

 
  
 
 RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies is can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are two callbacks invoked

	onExchangeBegin
	onExchangeDone



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

Camel provides the following policies out of the box:

	org.apache.camel.impl.ThrottlingRoutePolicy - 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.



ThrottlingRoutePolicy
The throttling 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 
 The logger category. 



Configuring policy

You configure the route policy as follows from Java DSL, using the routePolicy method:


  RoutePolicy myPolicy = new MyRoutePolicy();
  from("seda:foo").routePolicy(myPolicy).to("mock:result");



In Spring XML its a bit different as follows using the routePolicyRef attribute:


   "myPolicy" class="com.mycompany.MyRoutePolicy"/>
   
   "myPolicy">
   "seda:foo"/>
   "mock:result"/>
   



See Also

	Route Throttling Example for an example using this in practice
	Architecture


 
 
   
Change Notification Preferences
   

   View Online
   |
   View Change
  |
   Add Comment









[CONF] Apache Camel > RoutePolicy

2009-11-02 Thread confluence







RoutePolicy
Page  added by Claus Ibsen

 

 RoutePolicy
Available as of Camel 2.1

A route policy org.apache.camel.spi.RoutePolicy is used to control route(s) at runtime. For example you can use it to determine whether a route should be running or not. However the policies is can support any kind of use cases.

How it works
You associate a route with a given RoutePolicy and then during runtime Camel will invoke callbacks on this policy where you can implement your custom logic.

Camel provides a support class that is a good base class to extend org.apache.camel.impl.RoutePolicySupport. 

There are two callbacks invoked

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



Camel provides the following policies out of the box

	org.apache.camel.impl.ThrottlingRoutePolicy - 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.



ThrottlingRoutePolicy
The throttling 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 
 The logger category. 



Configuring policy

You configure the route policy as follows from Java DSL, using the routePolicy method:


  RoutePolicy myPolicy = new MyRoutePolicy();
  from("seda:foo").routePolicy(myPolicy).to("mock:result");



In Spring XML its a bit different as follows using the routePolicyRef attribute:


   "myPolicy" class="com.mycompany.MyRoutePolicy"/>
   
   "myPolicy">
   "seda:foo"/>
   "mock:result"/>
   



See Also

	Architecture
	The camel-example-route-throttling example in the Camel distribution




   
Change Notification Preferences
   
   View Online
  |
   Add Comment