Configuring the adapter

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

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

A sample configuration file for the AMQP adapter, containing configurations for source services, the AMQP_SERVER shared configuration, and metrics, is presented below:

Example 1. Sample configuration file
{
  "id": "amqp-adapter-1",
  "framework-version": 1,
  "application-version": 1,
  "diffusion": {
    "url": "ws://localhost:8090",
    "principal": "admin",
    "password": "password",
    "reconnectIntervalMs": 5000
  },
  "services": [
    {
      "serviceName": "simpleTopicPoller",
      "serviceType": "TOPIC_POLLER",
      "description": "Polls from a topic",
      "config": {
        "application": {
          "amqpServerConnection": {
            "connectionUrl": "amqp://localhost:5672"
          },
          "sourceName": "batchTopic",
          "diffusionTopicTemplate": "target/batchTopic"
        }
      }
    },
    {
      "serviceName": "simpleQueuePoller",
      "serviceType": "QUEUE_POLLER",
      "description": "Polls from a queue",
      "config": {
        "application": {
          "amqpServerConnection": {
            "connectionUrl": "amqp://localhost:5672"
          },
          "consumerCount": 5,
          "sourceName": "batchQueue",
          "diffusionTopicTemplate": "target/batchQueue"
        }
      }
    },
    {
      "serviceName": "simpleTopicListener",
      "serviceType": "TOPIC_LISTENER",
      "description": "Listens to a topic updates",
      "config": {
        "application": {
          "amqpServerConnection": {
            "connectionUrl": "amqp://localhost:5672"
          },
          "sourceName": "test_topic",
          "diffusionTopicTemplate": "target/test_topic"
        }
      }
    },
    {
      "serviceName": "simpleQueueListener",
      "serviceType": "QUEUE_LISTENER",
      "description": "Listens to queue updates",
      "config": {
        "application": {
          "amqpServerConnection": {
            "connectionUrl": "amqp://localhost:5672"
          },
          "consumerCount": 5,
          "sourceName": "test_queue",
          "diffusionTopicTemplate": "target/test_queue"
        }
      }
    }
  ],
  "global": {
    "framework": {
      "threadPoolSize": 10,
      "mode": "DYNAMIC",
      "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
    ...
}