...
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 |
---|
from("seda:a").throttle(100).asyncDelayed().to("seda:b");
|
Include Page | ||||
---|---|---|---|---|
|