Configuration file details

The configuration file must be in JSON format. The location of this file can be passed when starting the application, as a system property or environment variable gateway.config.file.

If both the system property and environment variable gateway.config.file are set, the value of the environment variable will take precedence over the system property.

The configuration structure is defined by the framework and is standard across any Gateway application. The entire configuration is a combination of framework defined and application defined configuration. Framework defined configuration parameters are the same for all Gateway applications whereas application defined configuration is application specific and is defined by application developers for the service types, sharedConfig types and application specific global configuration of the application.

Below is a sample configuration structure that includes framework-specific configuration parameters. The contents of the 'application' field would be defined by the application developer.

Example 1. Framework defined configuration structure
{
  "id": "gateway-application-1",
  "framework-version": 1,
  "application-version": 1,
  "diffusion": {
    "url": "ws://localhost:8080",
    "principal": "admin",
    "reconnectIntervalMs": 5000,
    "maximumMessageSize": 2147483647,
    "maximumQueueSize": 10000,
    "inputBufferSize": 524288,
    "outputBufferSize": 524288,
    "properties": {}
  },
  "sharedConfigs": [
    {
      "sharedConfigName": "sampleSharedConfig",
      "sharedConfigType": "SHARED_CONFIG_TYPE",
      "description": "Shared config",
      "config": {
        "application": {}
      }
    }
  ],
  "services": [
    {
      "serviceName": "SampleStreamingService",
      "description": "A streaming source",
      "serviceType": "A_STREAMING_SOURCE",
      "config": {
        "sharedConfigName": "sampleSharedConfig",
        "framework": {
          "publicationRetries": 5,
          "retryIntervalMs": 5000,
          "topicProperties": {
            "persistencePolicy": "SESSION",
            "timeSeries": false,
            "publishValuesOnly": false,
            "dontRetainValue": false
          }
        },
        "application": {},
        "state": "ACTIVE"
      }
    },
    {
      "serviceName": "publishPollingSource",
      "description": "A Polling source",
      "serviceType": "POLLING_SOURCE",
      "config": {
        "framework": {
          "publicationRetries": 5,
          "retryIntervalMs": 5000,
          "topicProperties": {
            "persistencePolicy": "SERVICE",
            "timeSeries": true,
            "publishValuesOnly": false,
            "dontRetainValue": false
          },
          "pollIntervalMs": 500,
          "pollTimeoutMs": 4000
        },
        "application": {},
        "state": "PAUSED"
      }
    },
    {
      "serviceName": "sampleSink",
      "description": "A simple sink",
      "serviceType": "SIMPLE_SINK",
      "config": {
        "framework": {
          "diffusionTopicSelector": "?language//",
          "updateTimeoutMs": 180000,
          "payloadConverters": [
            {
              "name": "$Object_to_JSON"
            }
          ]
        },
        "application": {},
        "state": "ACTIVE"
      }
    },
    {
      "serviceName": "hybridService",
      "description": "Subscribes to diffusion topic and publishes to another Diffusion topic",
      "serviceType": "HYBRID_SERVICE",
      "config": {
        "framework": {
          "sink": {
            "diffusionTopicSelector": "?rate//",
            "updateTimeoutMs": 180000
          },
          "source": {
            "publicationRetries": 5,
            "retryIntervalMs": 5000,
            "topicProperties": {
              "persistencePolicy": "SERVICE",
              "timeSeries": true,
              "timeSeriesRetainedRange": "limit 20",
              "publishValuesOnly": false,
              "dontRetainValue": false
            }
          }
        },
        "application": {},
        "state": "ACTIVE"
      }
    }
  ],
  "global": {
    "framework": {
      "threadPoolSize": 10,
      "mode": "DYNAMIC",
      "metrics": {
        "enabled": true,
        "filterMetricsPrefixes": []
      }
    },
    "application": {}
  }
}

When designing a gateway application, the developers must identify the configuration required for the service types and sharedConfig types they are going to support, and document them appropriately - so that users can create a configuration file which will be used when starting the application.

Using the configuration file, the application can be started as follows:

java -jar -Dgateway.config.file=./configuration.json application-2.2.0_RC1.jar

The schema for the framework defined configuration can be found in the artifact bundle, together with the framework jar.

The configuration file is split into seven main parts: