Configuring the adapter

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

Configuration for the Redis Adapter for Diffusion follows the Gateway Adapter Framework standard. Below is a sample configuration file for the Redis Adapter for Diffusion that connects a Redis server at redis://localhost:6379 to a Diffusion server at ws://localhost:8080 replicating all keys (see keyFilter) to Diffusion topics, using : as a key delimited, under root topic redis/ (see basepath).

In this context Redis key some:key:123 is reflected as Diffusion topic redis/some/key/1234.

Example 1. Sample configuration file
{
  "framework-version": 1,
  "application-version": 1,
  "id": "redis-adapter-0",
  "diffusion": {
    "url": "ws://localhost:8080",
    "principal": "admin",
    "password": "password",
    "reconnectIntervalMs": 1000,
    "maximumMessageSize": 2147483647,
    "maximumQueueSize": 10000,
    "inputBufferSize": 524288,
    "outputBufferSize": 524288,
    "properties": {}
  },
  "services": [

    {
      "serviceName": "redis-adapter-0",
      "description": "Example Redis Service",
      "serviceType": "RedisToDiffusion",
      "config": {
        "framework": {
          "publicationRetries": 5,
          "retryIntervalMs": 5000,
          "topicProperties": {
            "persistencePolicy": "SERVICE",
            "timeSeries": false,
            "publishesValueOnly": false,
            "doNotRetainValue": false
          }
        },
        "application": {
          "redisURI": "redis://localhost:6379",
          "batchSize": 2000,
          "batchTimeoutSeconds": 300,
          "keyDelimiter": ":",
          "keyFilter": "*",
          "topicPathPrefix": "redis/"
        },
        "state": "ACTIVE"
      }
    }

  ],
  "global": {
    "framework": {
      "threadPoolSize": 7,
      "mode": "DYNAMIC",
      "metrics": {
        "enabled": true
      }
    },
    "application": {
      "prometheus": {
        "path": "/prometheus",
        "port": 8085
      },
      "jmx": true
    }
  }
}

See Subscribing to Redis for more detail on Redis specific configuration.

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 following configuration versions:

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