Rest polling service type
The restPollingServiceType
is a service type of Polling Source mode. It can be used to poll REST endpoints and publish the obtained data into configured Diffusion topics.
There can be multiple instances of this service type added to the adapter, to consume data from different REST endpoints or APIs and publish them to different Diffusion topics, using different configurations.
Complete configuration for a service consists of the framework required configuration for polling source service and the service type specific configuration.
{
"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"
}
}
}
}
Polling service Framework configuration
Details about supported configuration parameters for framework configuration for the Polling service can be found here.
Application configuration
The supported application configuration parameters for this service are defined in the table below:
Property | Description | Default |
---|---|---|
|
REST API configuration |
- |
|
Topic configuration |
- |
restApi
JSON property
Property | Description | Default |
---|---|---|
|
The REST API base URL, for example: |
|
|
The REST API path, for example: |
- |
|
HTTP method. Options available, one of: |
- |
|
Username and password for basic access authentication. |
- |
|
HTTP headers as key/value pairs. |
- |
|
HTTP query parameters as key/value pairs. |
- |
|
A string value to be posted to a REST API. |
- |
topic
JSON property
Property | Description | Default |
---|---|---|
|
The Diffusion topic path. |
- |
|
Update mode, can be one of: SIMPLE, STREAMING. |
|
Configuration of restSharedConfigType is the same as that of restPollingServiceType service type.
|
If a sharedConfig instance is defined in the configuration and is referred to in the service configuration, the overall configuration of the service is formed using a combination of configuration defined in the sharedConfig instance and the service instance. When a duplicate configuration is defined in the sharedConfig instance and in the service instance, the configuration in service configuration will take precedence.
In the overall configuration of the service, the mandatory configurations required are: restApi.baseUrl
and topic.path
.
Below is a sample configuration of a service for the application
JSON property:
{
"restApi": {
"baseUrl": "service-base-url",
"path": "service-path",
"method": "post",
"basicAuth": {
"username": "username",
"password": "password"
},
"headers": {
"shk1": "shv1",
"shk2": true
},
"queryParameters": {
"sqk1": "sqv1",
"sqk2": [
1,
2,
3
]
},
"postContent": "post-content"
},
"topic": {
"path": "topic-path",
"updateMode": "STREAMING"
}
}
A JSON schema is provided in the bundle to assist with validation of the restPollingServiceType service configuration.
|