AMQP_SERVER shared config

The AMQP adapter supports only one type of sharedConfig - AMQP_SERVER. It defines the details of the AMQP server to connect to.

Once this shared config is defined, it can be referred to in any service configuration. This means that the AMQP server configuration can be defined as an AMQP_SERVER shared config and reused in multiple services.

Example 1. Sample adapter configuration containing a sharedConfig instance of type AMQP_SERVER and being used in services
{
  "sharedConfigs": [
    {
      "sharedConfigName": "rabbitMqBroker",
      "sharedConfigType": "AMQP_SERVER",
      "description": "Local rabbit mq connection details",
      "config": {
        "application": {
          "amqpServerConnection": {
            "connectionUrl": "amqp://localhost:5672",
            "username": "guest",
            "password": "guest",
            "maximumNumberOfRetries": 10,
            "initialRetryIntervalMs": 5,
            "maxRetryIntervalMs": 5000
          }
        }
      }
    }
  ],
  "services": [
    {
      "serviceName": "simpleTopicListener",
      "serviceType": "TOPIC_LISTENER",
      "description": "Listens to a topic updates",
      "config": {
        "sharedConfigName": "rabbitMqBroker",
        "application": {
          "sourceName": "test_topic",
          "diffusionTopicTemplate": "target/test_topic"
        }
      }
    },
    {
      "serviceName": "simpleQueueListener",
      "serviceType": "QUEUE_LISTENER",
      "description": "Listens to queue updates",
      "config": {
        "sharedConfigName": "rabbitMqBroker",
        "application": {
          "sourceName": "test_queue",
          "diffusionTopicTemplate": "target/test_queue"
        }
      }
    }
  ]
}

The supported application configuration parameters for this sharedConfig type are defined in the table below:

amqpServerConnection configuration parameters
Name Type Description Mandatory Default value

connectionUrl

string

The AMQP server connection URL, containing the full connection URL with port and/or other required details.

Yes

n/a

username

string

The username for the AMQP server connection.

No

n/a

password

string

The password for the AMQP server connection.

No

n/a

maximumNumberOfRetries

integer

The maximum number of retries for establishing a connection to the AMQP server. If this parameter is not set, the attempts will be infinite.

No

n/a

initialRetryIntervalMs

integer

Initial retry interval in milliseconds. It will increase exponentially with each retry until maxRetryIntervalMs is reached.

No

5

maxRetryIntervalMs

integer

Maximum retry interval in milliseconds.

No

5000

The adapter allows you to specify the amqpServerConnection through a shared configuration. If the amqpServerConnection is explicitly defined in the service configuration, a unique AMQP connection instance will be allocated to the service. However, if the sharedConfigName parameter is used to reference a shared configuration, the connection instance will be shared with any other services that reference the same shared configuration.
All configuration parameters for the AMQP_SERVER sharedConfig type can also be defined within the configuration of any service. However, a service can either refer to a shared configuration or specify AMQP server connection details within its configuration, but not both.

See Configuring the adapter for a complete example of the configuration for the adapter, which specifies an instance of AMQP_SERVER sharedConfig and refers to it in the service configurations.