You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

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

Error formatting macro: snippet: java.lang.NullPointerException

So the above example will throttle messages all messages received on queue:a until the JMSTimestamp plus 3 seconds before sending them to mock:result.

You can of course use many different Expression languages such as XPath, XQuery, SQL or various Scripting Languages. You can just delay things a fixed amount of time from the point at which the delayer receives the message. For example to delay things 2 seconds

delayer(2000)

The above assume that the delivery order is maintained and that the messages are delivered in delay order. If you want to reorder the messages based on delivery time, you can use the Resequencer with this pattern. For example

from("activemq:someQueue").resequencer(header("MyDeliveryTime")).delay("MyRedeliveryTime").to("activemq:aDelayedQueue");

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

Using the Spring XML Extensions

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.

  • No labels