[CONF] Apache Camel > Throttler

2014-07-02 Thread David J. M. Karlsen (Confluence)














  


David J. M. Karlsen edited the page:
 


Throttler   






...



 Wiki Markup




 {div:class=confluenceTableSmall}
|| Name || Default Value || Description ||
| {{maximumRequestsPerPeriod}} | | Maximum number of requests per period to throttle. This option must be provided as a positive number. Notice, in the XML DSL, from *Camel 2.8* onwards this option is configured using an [_expression_] instead of an attribute. |
| {{timePeriodMillis}} | {{1000}} | The time period in milliseconds, in which the throttler will allow at most {{maximumRequestsPerPeriod}} number of messages. |
| {{asyncDelayed}} | {{false}} | *Camel 2.4:* If enabled then any messages which is delayed happens asynchronously using a scheduled thread pool. |
| {{executorServiceRef}} | |  *Camel 2.4:* Refers to a custom [Thread Pool|Threading Model] to be used if {{asyncDelay}} has been enabled. |
| {{callerRunsWhenRejected}} | {{true}} | *Camel 2.4:* Is used if {{asyncDelayed}} was enabled. This controls if the caller thread should execute the task if the thread pool rejected the task. |
| {{rejectExecution}} | {{false}} | *Camel 2.14:* If this option is true, throttler throws thea RejectExecutionExceptionThrottlerRejectExecutionException when the request rate exceeds the limit. |
{div} 



...






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

2014-06-13 Thread David J. M. Karlsen (Confluence)














  


David J. M. Karlsen edited the page:
 


Throttler   






...



 Wiki Markup




 {div:class=confluenceTableSmall}
|| Name || Default Value || Description ||
| {{maximumRequestsPerPeriod}} | | Maximum number of requests per period to throttle. This option must be provided as a positive number. Notice, in the XML DSL, from *Camel 2.8* onwards this option is configured using an [_expression_] instead of an attribute. |
| {{timePeriodMillis}} | {{1000}} | The time period in milliseconds, in which the throttler will allow at most {{maximumRequestsPerPeriod}} number of messages. |
| {{asyncDelayed}} | {{false}} | *Camel 2.4:* If enabled then any messages which is delayed happens asynchronously using a scheduled thread pool. |
| {{executorServiceRef}} | |  *Camel 2.4:* Refers to a custom [Thread Pool|Threading Model] to be used if {{asyncDelay}} has been enabled. |
| {{callerRunsWhenRejected}} | {{true}} | *Camel 2.4:* Is used if {{asyncDelayed}} was enabled. This controls if the caller thread should execute the task if the thread pool rejected the task. |
| {{rejectExectionrejectExecution}} | {{false}} | *Camel 2.14:* If this option is true, throttler throws the RejectExecutionException when the request rate exceeds the limit. |
{div} 



...






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

2014-06-12 Thread willem jiang (Confluence)














  


willem jiang edited the page:
 


Throttler   






...



 Wiki Markup




 {div:class=confluenceTableSmall}
|| Name || Default Value || Description ||
| {{maximumRequestsPerPeriod}} | | Maximum number of requests per period to throttle. This option must be provided as a positive number. Notice, in the XML DSL, from *Camel 2.8* onwards this option is configured using an [_expression_] instead of an attribute. |
| {{timePeriodMillis}} | {{1000}} | The time period in milliseconds, in which the throttler will allow at most {{maximumRequestsPerPeriod}} number of messages. |
| {{asyncDelayed}} | {{false}} | *Camel 2.4:* If enabled then any messages which is delayed happens asynchronously using a scheduled thread pool. |
| {{executorServiceRef}} | |  *Camel 2.4:* Refers to a custom [Thread Pool|Threading Model] to be used if {{asyncDelay}} has been enabled. |
| {{callerRunsWhenRejected}} | {{true}} | *Camel 2.4:* Is used if {{asyncDelayed}} was enabled. This controls if the caller thread should execute the task if the thread pool rejected the task. |
| {{rejectExection}} | {{false}} | *Camel 2.14:* If this option is true, throttler throws the RejectExecutionException when the request rate exceeds the limit. |
{div} 



Examples
 Using the Fluent Builders 
...
Note that since timePeriodMillis defaults to 1000 milliseconds, just setting the maximumRequestsPerPeriod has the effect of setting the maximum number of requests per second. So to throttle requests at 100 requests per second between two endpoints, it would look more like this...



 Code Block




 

from("seda:a").throttle(100).to("seda:b");
 



...
You can let the Throttler use non blocking asynchronous delaying, which means Camel will use a scheduler to schedule a task to be executed in the future. The task will then continue routing. This allows the caller thread to not block and be able to service other messages, etc.



 Code Block

[CONF] Apache Camel > Throttler

2011-04-16 Thread confluence







Throttler
Page edited by Claus Ibsen


 Changes (1)
 




...
{div:class=confluenceTableSmall} || Name || Default Value || Description || 
| {{maximumRequestsPerPeriod}} | | Maximum number of requests per period to throttle. This option must be provided and a positive number. Notice, in the XML DSL, from *Camel 2.8* onwards this option is configured using an [_expression_] instead of an attribute. | 
| {{timePeriodMillis}} | {{1000}} | The time period in millis, in which the throttler will allow at most {{maximumRequestsPerPeriod}} number of messages. | | {{asyncDelayed}} | {{false}} | *Camel 2.4:* If enabled then any messages which is delayed happens asynchronously using a scheduled thread pool. | 
...


Full Content

Throttler

The Throttler Pattern allows you to ensure that a specific endpoint does not get overloaded, or that we don't exceed an agreed SLA with some external service.

Options




 Name 
 Default Value 
 Description 


 maximumRequestsPerPeriod 
 
 Maximum number of requests per period to throttle. This option must be provided and a positive number. Notice, in the XML DSL, from Camel 2.8 onwards this option is configured using an _expression_ instead of an attribute. 


 timePeriodMillis 
 1000 
 The time period in millis, in which the throttler will allow at most maximumRequestsPerPeriod number of messages. 


 asyncDelayed 
 false 
 Camel 2.4: If enabled then any messages which is delayed happens asynchronously using a scheduled thread pool. 


 executorServiceRef 
 
  Camel 2.4: Refers to a custom Thread Pool to be used if asyncDelay has been enabled. 


 callerRunsWhenRejected 
 true 
 Camel 2.4: Is used if asyncDelayed was enabled. This controls if the caller thread should execute the task if the thread pool rejected the task. 





Examples

Using the Fluent Builders


from("seda:a").throttle(3).timePeriodMillis(1).to("log:result", "mock:result");



So the above example will throttle messages all messages received on seda:a before being sent to mock:result ensuring that a maximum of 3 messages are sent in any 10 second window. Note that typically you would often use the default time period of a second. So to throttle requests at 100 requests per second between two endpoints it would look more like this...



from("seda:a").throttle(100).to("seda:b");



For further examples of this pattern in use you could look at the junit test case

Using the Spring XML Extensions
Camel 2.7.x or older


  "seda:a" />
  "3" timePeriodMillis="1">
"mock:result" />
  




Camel 2.8 onwards
In Camel 2.8 onwards you must set the maximum period as an _expression_ as shown below where we use a Constant _expression_:


"seda:a"/>

"1">
3
"mock:result"/>





Dynamically changing maximum requests per period
Available os of Camel 2.8 
Since we use an _expression_ you can adjust this value at runtime, for example you can provide a header with the value. At runtime Camel evaluates the _expression_ and converts the result to a java.lang.Long type. In the example below we use a header from the message to determine the maximum requests per period. If the header is absent, then the Throttler uses the old value. So that allows you to only provide a header if the value is to be changed:


"direct:expressionHeader"/>
"500">

throttleValue
"mock:result"/>





Asynchronous delaying
Available as of Camel 2.4

You can let the Throttler use non blocking asynchronous delaying, which means Camel will use a scheduler to schedule a task to be executed in the future. The task will then continue routing. This allows the caller thread to not block and be able to service other messages etc.



from("seda:a").throttle(100).asyncDelayed().to("seda:b");



Using This Pattern

If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out.



Change Notification Preferences

View Online
|
View Changes
|
Add Comment









[CONF] Apache Camel > Throttler

2011-04-16 Thread confluence







Throttler
Page edited by Claus Ibsen


 Changes (4)
 




...
{div:class=confluenceTableSmall} || Name || Default Value || Description || 
| {{maximumRequestsPerPeriod}} | | Maximum number of requests per period to throttle. This option must be provided and a positive number. Notice, in the XML DSL, from Camel 2.8 onwards this option is configured using an [_expression_] instead of an attribute. | 
| {{timePeriodMillis}} | {{1000}} | The time period in millis, in which the throttler will allow at most {{maximumRequestsPerPeriod}} number of messages. | | {{asyncDelayed}} | {{false}} | *Camel 2.4:* If enabled then any messages which is delayed happens asynchronously using a scheduled thread pool. | 
...
 *Using the [Spring XML Extensions]* 
h4. Camel 2.7.x or older {snippet:id=example|lang=xml|url="" 
 
h4. Camel 2.8 onwards In Camel 2.8 onwards you must set the maximum period as an [_expression_] as shown below where we use a [Constant] _expression_: 
{snippet:id=example|lang=xml|url=""  
h3. Dynamically changing maximum requests per period *Available os of Camel 2.8*  Since we use an [_expression_] you can adjust this value at runtime, for example you can provide a header with the value. At runtime Camel evaluates the _expression_ and converts the result to a {{java.lang.Long}} type. In the example below we use a header from the message to determine the maximum requests per period. If the header is absent, then the [Throttler] uses the old value. So that allows you to only provide a header if the value is to be changed: {snippet:id=e2|lang=xml|url=""  
h3. Asynchronous delaying *Available as of Camel 2.4* 
...


Full Content

Throttler

The Throttler Pattern allows you to ensure that a specific endpoint does not get overloaded, or that we don't exceed an agreed SLA with some external service.

Options




 Name 
 Default Value 
 Description 


 maximumRequestsPerPeriod 
 
 Maximum number of requests per period to throttle. This option must be provided and a positive number. Notice, in the XML DSL, from Camel 2.8 onwards this option is configured using an _expression_ instead of an attribute. 


 timePeriodMillis 
 1000 
 The time period in millis, in which the throttler will allow at most maximumRequestsPerPeriod number of messages. 


 asyncDelayed 
 false 
 Camel 2.4: If enabled then any messages which is delayed happens asynchronously using a scheduled thread pool. 


 executorServiceRef 
 
  Camel 2.4: Refers to a custom Thread Pool to be used if asyncDelay has been enabled. 


 callerRunsWhenRejected 
 true 
 Camel 2.4: Is used if asyncDelayed was enabled. This controls if the caller thread should execute the task if the thread pool rejected the task. 





Examples

Using the Fluent Builders


from("seda:a").throttle(3).timePeriodMillis(1).to("log:result", "mock:result");



So the above example will throttle messages all messages received on seda:a before being sent to mock:result ensuring that a maximum of 3 messages are sent in any 10 second window. Note that typically you would often use the default time period of a second. So to throttle requests at 100 requests per second between two endpoints it would look more like this...



from("seda:a").throttle(100).to("seda:b");



For further examples of this pattern in use you could look at the junit test case

Using the Spring XML Extensions
Camel 2.7.x or older


  "seda:a" />
  "3" timePeriodMillis="1">
"mock:result" />
  




Camel 2.8 onwards
In Camel 2.8 onwards you must set the maximum period as an _expression_ as shown below where we use a Constant _expression_:


"seda:a"/>

"1">
3
"mock:result"/>





Dynamically changing maximum requests per period
Available os of Camel 2.8 
Since we use an _expression_ you can adjust this value at runtime, for example you can provide a header with the value. At runtime Camel evaluates the _expression_ and converts the result to a java.lang.Long type. In the example below we use a header from the message to determine the maximum requests per period. If the header is absent, then the Throttler uses the old value. So that allows you to only provide a header if the value is to be changed:
Error formatting macro: snippet: java.lang.IndexOutOfBoundsException: Index: 20, Size: 20 

Asynchronous delaying
Available as of Camel 2.4

You can let the Throttler use non blocking asynchronous delaying, which means Camel will use a scheduler to schedule a task to be executed in the future. The task will then continue routing. This allows the caller thread to not block and be able to service other messages etc.



from("seda:a"

[CONF] Apache Camel > Throttler

2011-04-14 Thread confluence







Throttler
Page edited by Claus Ibsen


 Changes (1)
 




...
The Throttler Pattern allows you to ensure that a specific endpoint does not get overloaded, or that we don't exceed an agreed SLA with some external service.  
h3. Options  {div:class=confluenceTableSmall} || Name || Default Value || Description || | {{maximumRequestsPerPeriod}} | | Maximum number of requests per period to throttle. This option must be provided and a positive number. | | {{timePeriodMillis}} | {{1000}} | The time period in millis, in which the throttler will allow at most {{maximumRequestsPerPeriod}} number of messages. | | {{asyncDelayed}} | {{false}} | *Camel 2.4:* If enabled then any messages which is delayed happens asynchronously using a scheduled thread pool. | | {{executorServiceRef}} | |  *Camel 2.4:* Refers to a custom [Thread Pool|Threading Model] to be used if {{asyncDelay}} has been enabled. | | {{callerRunsWhenRejected}} | {{true}} | *Camel 2.4:* Is used if {{asyncDelayed}} was enabled. This controls if the caller thread should execute the task if the thread pool rejected the task. | {div}  h3. Examples  
*Using the [Fluent Builders]*  
...


Full Content

Throttler

The Throttler Pattern allows you to ensure that a specific endpoint does not get overloaded, or that we don't exceed an agreed SLA with some external service.

Options




 Name 
 Default Value 
 Description 


 maximumRequestsPerPeriod 
 
 Maximum number of requests per period to throttle. This option must be provided and a positive number. 


 timePeriodMillis 
 1000 
 The time period in millis, in which the throttler will allow at most maximumRequestsPerPeriod number of messages. 


 asyncDelayed 
 false 
 Camel 2.4: If enabled then any messages which is delayed happens asynchronously using a scheduled thread pool. 


 executorServiceRef 
 
  Camel 2.4: Refers to a custom Thread Pool to be used if asyncDelay has been enabled. 


 callerRunsWhenRejected 
 true 
 Camel 2.4: Is used if asyncDelayed was enabled. This controls if the caller thread should execute the task if the thread pool rejected the task. 





Examples

Using the Fluent Builders


from("seda:a").throttle(3).timePeriodMillis(1).to("log:result", "mock:result");



So the above example will throttle messages all messages received on seda:a before being sent to mock:result ensuring that a maximum of 3 messages are sent in any 10 second window. Note that typically you would often use the default time period of a second. So to throttle requests at 100 requests per second between two endpoints it would look more like this...



from("seda:a").throttle(100).to("seda:b");



For further examples of this pattern in use you could look at the junit test case

Using the Spring XML Extensions



  "seda:a" />
  "3" timePeriodMillis="1">
"mock:result" />
  




Asynchronous delaying
Available as of Camel 2.4

You can let the Throttler use non blocking asynchronous delaying, which means Camel will use a scheduler to schedule a task to be executed in the future. The task will then continue routing. This allows the caller thread to not block and be able to service other messages etc.



from("seda:a").throttle(100).asyncDelayed().to("seda:b");



Using This Pattern

If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out.



Change Notification Preferences

View Online
|
View Changes
|
Add Comment









[CONF] Apache Camel > Throttler

2010-07-02 Thread confluence







Throttler
Page edited by Claus Ibsen


 Changes (2)
 



...
 {code} 
from("seda:a").throttler(100).to("seda:b"); 
{code}  
...
{snippet:id=example|lang=xml|url=""  
h3. Asynchronous delaying *Available as of Camel 2.4*  You can let the [Throttler] use non blocking asynchronous delaying, which means Camel will use a scheduler to schedule a task to be executed in the future. The task will then continue routing. This allows the caller thread to not block and be able to service other messages etc.  {code} from("seda:a").throttle(100).asyncDelayed().to("seda:b"); {code}  
{include:Using This Pattern} 

Full Content

Throttler

The Throttler Pattern allows you to ensure that a specific endpoint does not get overloaded, or that we don't exceed an agreed SLA with some external service.

Using the Fluent Builders


from("seda:a").throttle(3).timePeriodMillis(1).to("log:result", "mock:result");



So the above example will throttle messages all messages received on seda:a before being sent to mock:result ensuring that a maximum of 3 messages are sent in any 10 second window. Note that typically you would often use the default time period of a second. So to throttle requests at 100 requests per second between two endpoints it would look more like this...



from("seda:a").throttle(100).to("seda:b");



For further examples of this pattern in use you could look at the junit test case

Using the Spring XML Extensions



  "seda:a" />
  "3" timePeriodMillis="1">
"mock:result" />
  




Asynchronous delaying
Available as of Camel 2.4

You can let the Throttler use non blocking asynchronous delaying, which means Camel will use a scheduler to schedule a task to be executed in the future. The task will then continue routing. This allows the caller thread to not block and be able to service other messages etc.



from("seda:a").throttle(100).asyncDelayed().to("seda:b");



Using This Pattern

If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out.



Change Notification Preferences

View Online
|
View Changes
|
Add Comment









[CONF] Apache Camel: Throttler (page edited)

2009-01-19 Thread confluence










Page Edited :
CAMEL :
Throttler



 
Throttler
has been edited by Torsten Mielke
(Jan 19, 2009).
 

 
 (View changes)
 

Content:
Throttler

The Throttler Pattern allows you to ensure that a specific endpoint does not get overloaded, or that we don't exceed an agreed SLA with some external service.

Using the Fluent Builders


from("seda:a").throttle(3).timePeriodMillis(1).to("mock:result");


So the above example will throttle messages all messages received on seda:a before being sent to mock:result ensuring that a maximum of 3 messages are sent in any 10 second window. Note that typically you would often use the default time period of a second. So to throttle requests at 100 requet per second between two endpoints it would look more like this...


from("seda:a").throttler(100).to("seda:b");


For further examples of this pattern in use you could look at the junit test case

Using the Spring XML Extensions



  "seda:a" />
  "3" timePeriodMillis="1">
"mock:result" />
  



Using This Pattern

If you would like to use this EIP Pattern then please read the Getting Started, you may also find the Architecture useful particularly the description of Endpoint and URIs. Then you could try out some of the Examples first before trying this pattern out.











Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request

Unsubscribe or edit your notifications preferences