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 CDC 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 CDC adapter is presented below:

Example 1. Sample configuration file
{
  "id": "cdc-adapter-1",
  "framework-version": 1,
  "application-version": 1,
  "diffusion": {
    "url": "ws://localhost:8090",
    "principal": "admin",
    "password": "password",
    "reconnectIntervalMs": 5000
  },
  "sharedConfigs": [
    {
      "sharedConfigName": "mySqlDatabaseConnector",
      "sharedConfigType": "DATABASE_CONNECTOR",
      "description": "Database connector for mysql database",
      "config": {
        "application": {
          "debeziumConfigs": {
            "connector.class": "io.debezium.connector.mysql.MySqlConnector",
            "offset.storage": "org.apache.kafka.connect.storage.MemoryOffsetBackingStore",
            "offset.storage.file.filename": "/tmp/offsets.dat",
            "offset.flush.interval.ms": "60000",
            "database.history": "io.debezium.relational.history.MemoryDatabaseHistory",
            "database.hostname": "localhost",
            "database.port": "3306",
            "database.user": "mysqluser",
            "database.password": "mysqlpw",
            "schema.history.internal": "io.debezium.storage.file.history.FileSchemaHistory",
            "schema.history.internal.file.filename": "/tmp/schemahistory.dat"
          }
        }
      }
    }
  ],
  "services": [
    {
      "serviceName": "customerTableReader",
      "serviceType": "DATABASE_READER",
      "description": "Reads 'customer' table and publishes to Diffusion with ROW type topic mapping",
      "config": {
        "sharedConfigName": "mySqlDatabaseConnector",
        "framework": {
          "topicProperties": {
            "persistencePolicy": "SERVICE",
            "timeSeries": true,
            "timeSeriesRetainedRange": "last 1H",
            "dontRetainValue": false
          }
        },
        "application": {
          "debeziumConfigs": {
            "database.server.name": "customerTableReader",
            "name": "customerTableReader",
            "database.server.id": "8192",
            "database.include.list": "inventory",
            "table.include.list": "inventory.customers",
            "topic.prefix": "inventoryPrefix"
          },
          "topicMapping": "ROW",
          "includeSchema": true,
          "snapshot": true,
          "diffusionTopicPattern": "prefix/${table}"
        }
      }
    },
    {
      "serviceName": "addressesTableReader",
      "serviceType": "DATABASE_READER",
      "description": "Reads 'addresses' table and publishes to Diffusion with OBJECT type topic mapping ",
      "config": {
        "sharedConfigName": "mySqlDatabaseConnector",
        "framework": {
          "topicProperties": {
            "persistencePolicy": "SESSION"
          }
        },
        "application": {
          "debeziumConfigs": {
            "database.server.name": "addressesTableReader",
            "name": "addressesTableReader",
            "database.server.id": "8194",
            "database.include.list": "inventory",
            "table.include.list": "inventory.addresses",
            "topic.prefix": "addressPrefix"
          },
          "snapshot": true,
          "includeSchema": true,
          "diffusionTopicPattern": "prefix/${database}/${table}"
        }
      }
    }
  ],
  "global": {
    "framework": {
      "threadPoolSize": 10,
      "mode": "DYNAMIC",
      "metrics": {
        "enabled": true
      }
    },
    "application": {
      "prometheus": {
        "port": 8085,
        "path": "/metrics"
      }
    }
  }
}

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,
    ...
}