Skip to content

Home

Introduction

Development

IDEs

Services

API Explorer

Releases

Release notes

Martini Runtime

Martini Desktop

Martini Online

Feature requests

Bug reports

examples package: Throttling and monetization

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

To see these configured rules, open the Throttling and Monetization dialog.

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 Martini'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 Martini's throttling mechanism by trying to invoke more services than what is allowed.