Throttling component
The Throttling component is used to throttle messages, allowing a maximum number of messages to pass through to the next component per time period. It is often used to ensure that a specific endpoint does not get overloaded with requests.
Configuration
The Throttling component has the following basic configuration options:
Time period
The time period, in milliseconds, during which the Max requests count is valid.
The moment a flow is installed and starts running in the backend marks the beginning of the first time period. During this 'window,' the maximum number of messages configured in Max requests passes through. When this time period ends, the second 'window' begins, allowing the maximum number of messages to pass through again, and so on.
Max requests
The number of messages allowed to pass through to the next component for each Time period.
Using Throttling
In the example below the Throttling component has its Time period set to 10000
milliseconds and Max requests to 5
.
Messages coming from the Inbound HTTP component will be throttled, and every 10 seconds, a maximum of 5 messages are passed through to the Email component.
Whenever the Throttling component passes multiple messages at once, they still follow their own seperate route. They are not aggregated.
The Throttling component will halt on messages with a null
body.
Throttling and Split
Using a Throttling component in the bottom route of a Split component splitted messages are passed through consecutively.
In the example below the Throttling component has its Time period set to 10000
milliseconds and Max requests to 1
.
The Velocity component contains the XML shown below and the Split component uses xPath to split the XML on the product element. This spits the XML into three <product>n</product>
messages.
<products>
<product>1</product>
<product>2</product>
<product>3</product>
</products>
When the messages arrive at the Throttling component, the:
- 1st message passes between 0 and 10 seconds (depending on the time period 'window').
- 2nd message passes 10 seconds after the 1st one.
- 3rd message passes 10 seconds after the 2nd one.
Setting the Max requests to 2
, the:
- 1st and 2nd message pass between 0 and 10 seconds (depending on the time period 'window').
- 3rd message passes 10 seconds after the 1st and 2nd one.