Thursday, October 8, 2020

SAP API Management - Spike Arrest Policy - Identifier

 Scenario: Suppose you want to apply Spike Arrest policy based on Client

Steps:

1. Add an instance of Spike Arrest in Preflow for incoming request.




2. Modify the code as per requirement.

Code ( 2pm means in each 30 secs, only one call will be allowed)

<!-- This policy throttles the number of requests processed by an API Proxy protecting against performance lags and downtime -->

<SpikeArrest async="true" continueOnError="false" enabled="true" xmlns="http://www.sap.com/apimgmt">

<!-- can be used to uniquely identify an application or a client -->

<Identifier ref="request.header.client"></Identifier>

<Rate>2pm</Rate>

<UseEffectiveCount>true</UseEffectiveCount>

</SpikeArrest>

3. Test the API. 

In this case, during 2nd call within 30 secs for same client, the below response is received.

Put Header as client : ClientA











No comments:

Post a Comment