Configuring the adapter

Prerequisite: See configuring Gateway Application for an overview of how to configure a Gateway application.

The structure of the configuration for the REST adapter is similar to any Gateway application, with the difference of configuration for supported service types and sharedConfig type.

A sample configuration file for the REST adapter, which contains configuration for REST polling services, is presented below:

Example 1. Sample configuration file
{
  "framework-version": 1,
  "application-version": 1,
  "id":  "rest-adapter-using-sample-config",
  "diffusion": {
    "url": "ws://localhost:8080",
    "principal": "admin",
    "password": "password",
    "reconnectIntervalMs": 5000
  },
  "sharedConfigs": [
  ],
  "services": [
    {
      "serviceName": "rates-of-exchange",
      "serviceType": "restPollingServiceType",
      "description": "",
      "config": {
        "framework": {
          "pollIntervalMs": 15000,
          "pollTimeoutMs": 10000
        },
        "application": {
          "restApi": {
            "baseUrl": "https://api.fiscaldata.treasury.gov/services/api/fiscal_service",
            "path": "/v1/accounting/od/rates_of_exchange"
          },
          "topic": {
            "path": "rates-of-exchange",
            "updateMode": "STREAMING"
          }
        }
      }
    }
  ],
  "global": {
    "framework": {
      "metrics": {
        "enabled": true
      }
    }
  }
}

Configuration version

The application configuration version this adapter supports is 1.

The framework configuration version expected by the framework used with this adapter is also 1.

Hence, the configuration for the adapter should be created with the following configuration versions:

{
    ...
    "framework-version": 1,
    "application-version": 1,
    ...
}