[CONF] Apache Camel: Throttler (page edited)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[CONF] Apache Camel: Throttler (page edited)

Dhiraj Bokde (Confluence)

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(10000).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

<route>
  <from uri="seda:a" />
  <throttle maximumRequestsPerPeriod="3" timePeriodMillis="10000">
    <to uri="mock:result" />
  </throttle>
</route>

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.