/DotNet-Throttling-Example

This repository contains a example how to react on our platform throttling with dot net.

Primary LanguageC#MIT LicenseMIT

DotNet-Throttling-Example

This repository contains a DotNet Core 3.1 based example project which use following NuGet packages:

It shows a solution how to handle throttled platform requests.

How to use

In the configuration file appsettings.json it is possible to include the settings shown in the sample below. With these settings the behavior of the policy is defined which is handling the case of a custom exception from type HttpClientRequestException with the http status code 429 to many requests. You are able to define for each platform endpoint and http method a time to wait in seconds that will be converted into a TimeSpan.

{
    "DocuWarePlatform": {
    "ThrottlingDefaultRetryAfterSeconds": 300, 
    "Throttling": [
      {
        "Endpoint": "/DocuWare/Platform/Account/Logon",
        "Method": "POST",
        "SecondsToWait": 60
      },
      {
        "Endpoint": "/DocuWare/Platform/FileCabinets/Index",
        "Method": "GET",
        "SecondsToWait": 60 
      }
    ]
  } 
}