Version: 17.07
Supported Since: 17.01
A Concurrency Throttle is a processing element which controls the number of concurrent messages being processed in the flow. Typical scenarios for this are as follows.
A server can only handle a certain number of concurrent messages. Therefore Concurrency Throttle can be used to make sure the server does not get overloaded with requests.
An organization wishes to spread processing across a number of servers. Concurrency Throttle can be used to limit the concurrent messages to a server, but then distribute the overflow messages to a secondary server, which itself may have a similar rule. In this way, traffic is distributed across servers.
Traffic above a certain level may indicate a data-harvesting attack. Therefore Concurrency Throttle would be configured to keep traffic below this level.
In order to use this processing element, you must first select the Throttle Processor dependency from the processor list when you are creating an empty Ultra project. If you have already created a project, you can add this dependency via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Processors list, select the Throttle Processor dependency. Alternatively, you can add the following dependency to the maven pom.xml manually.
|
Allowed |
The message will be sent to this outport if messages in processing has not exceeded concurrency level |
Denied |
The message will be sent to this outport if messages in processing has exceeded concurrency level |
On Exception |
The message will be sent to this outport if the processing element failed in concurrency throttling |
Concurrency * |
Basic |
This parameter represents the number of allowed concurrent messages in processing. |
||
Consider All Branches * |
Basic |
Boolean parameter to set whether to wait till all branches of the message be complete to mark message as completed the flow or whether to only consider the main branch to mark message as completed. Defaults to false.
|
In this use case, concurrency throttle is used to only allow five concurrent message in the flow and all the excess requests will end their flow with the Exceptional Flow End processing element. To demonstrate the concurrency throttle operation, NIO HTTP Ingress Connector and NIO HTTP Egress Connector is used. Complete flow for the use case is shown below.
Configuration of the Concurrency Throttle processing element is shown below.
Since the concurrency is set to five, when the number of concurrent messages in flow exceeds five those requests will be rejected and forwarded through the denied out port and other messages are forwarded through the allowed out port.