Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

So the above example will throttle messages all messages received on queueseda:a until the JMSTimestamp plus 3 seconds before sending them before being sent 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

Code Block

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 ensuring that a maximum of 3 messages are sent in any 30 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...

Code Block
from("activemqseda:someQueuea").resequencer(header("MyDeliveryTime")).delay("MyRedeliveryTime").throttler(100).to("activemqseda:aDelayedQueueb");

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

...