Content Based Throttles
Overview of content based throttles.
Using TIBCO API Exchange Gateway allows you can create custom throttles based on the content information in the facade request.
For any throttle configuration specified in the Config UI, you can extend a throttle configuration to create a monitor. Using this monitor, you enforce a custom throttle policy based on the data of the message. You can create a monitor to extract a value based on the data in the request message. This value is used as an increment counter for the throttle count.
You can create a custom throttle monitor by defining a metric based on the request content of the message. The metric is defined by the following parameters:
- metricName: specifies the name of the throttle to be used from the Config UI configuration.
- metricIncrement: specifies the increment value for the throttle count. The metric increment value for the throttle (monitor) is defined, typically as an XPath formula based on the data content of the request message.
The monitor for a throttle is defined in a transformation (XSLT) file. The XSLT file is configured as a parse XSLT file for an operation. When a request goes through the parsing step of the request operation, the Core Engine reads all the data from the XSLT file and creates the throttle monitors.
For example, you can define a throttle for a bookorder service that orders the books from a store. You can define the throttle in such a way that the service is not overloaded with the client requests.
A throttle T1_BookOrder is defined in such a way that the throttle T1_BookOrder allows a user to order only 20 books in 10 seconds. In such a case, a throttle T1_BookOrder is configured using the Config UI as follows:
Throttle Name: T1_BookOrder
Throttle Type: Rate
Throttle Interval: 10 seconds
Throttle Max Count: 20
For this scenario, the Core Engine allows a maximum of 20 requests within 10 seconds. You can extend the throttle policy by creating a monitor to allow a specific number of book orders in a single request.
For example, you can create a custom throttle monitor for this throttle T1_BookOrder to increment the throttle count based on the number of book orders in the request. This allows you to customize the throttle count by providing the increment counter defined as metricIncrement for the monitor. The metricIncrement for this monitor can be populated using an XPath formula based on the total number of book orders in the request message. In this case, you can define the metricIncrement to count the book orders in the request. So, if the count of book orders in a request is 5, then it increments the throttle count as 5 allowing only 4 similar requests within 10 seconds.
- Configure Content-Based Throttles
- Configuring Throttle
Define the throttle in the Config UI to create a custom throttle monitor. - Define XSLT File
Define an XSLT transformation file to configure a throttle monitor. - Uploading XSLT File
After you define the XSLT file for a throttle monitor, upload the file in the New ProcessBody XSLT field on facade Operations tab in the Config UI.