Skip to content

Home

Introduction

Development

IDEs

Services

Service manager

API Explorer

examples package: Throttling and monetization

The examples package also generates Monitor rules upon start-up to show how TORO Integrate's API throttling and monetization features work.

To see these configured rules, open the Throttling and Monetization dialog or tab in Coder.

Related articles

Please see the following articles for more information:

Try it!

Start up the examples package and ensure that the auto-generated users, groups, and rules are present to be able to test TORO Integrate's throttling and monetization feature.

To do the test, you can:

  • Run the InvokeMonetizedApi service directly.
  • Invoke the REST web service at /api/monetization/hello/{name} until it reaches the usage limit. You can use the API Explorer for this; when doing so, select the Swagger specification at /rest/throttlingAndMonetization/controller/Monetization/swagger.json and authorize the request using the following credentials below:
User name Password Monitor Rule Invoke limit per minute, hour, day, week, month
Demo DEFAULT Rule 1 3, 7, 12, 14, 20
DemoII DEFAULT Rule 2 5, 10, 18, 24, 30

The services relevant for demonstrating this example are found under the throttlingAndMonetization package, as seen below:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
examples
├── ...
└── code
    └── throttlingAndMonetization
        ├── InvokeMonetizedApi.gloop
        ├── config
        │   ├── ShutdownMonetizationConfig.gloop
        │   └── StartMonetizationConfig.gloop
        ├── controller
        │   └── Monetization.api
        ├── helper
        │   ├── RuleHelper.gloop
        │   └── UserHelper.gloop
        └── httpClient
            └── InvokeEndpoint.gloop

Explanation

A service has been configured to create the users, groups, and Monitor rules for this example (if not configured yet); just run util.CheckDependency under /examples/code. Since these are already pre-configured for you, simply trigger TORO Integrate's throttling mechanism by trying to invoke more services than what is allowed.