Skip to main content
Version: Next

MQTT Control API for Bridges

Premium
Version 3.1

The below mentioned plugins provide a MQTT Control API that, among others, allows to change their configuration without the need to change the config file by hand or to restart the broker afterwards. Furthermore, the configuration gets synchronized across nodes when you have set up a clusterized environment.

MQTT control topic

The plugins can be controlled by sending command messages to a topic. Responses are also published to the topic followed by /response. The topic depends on the bridge, you are trying to configure or request information about:

BridgeTopicResponse Topic
Azure Bridge$CONTROL/cedalo/azure-eventhubs-bridge/v1$CONTROL/cedalo/azure-eventhubs-bridge/v1/response
Influx DB Bridge$CONTROL/cedalo/influxdb-bridge/v1$CONTROL/cedalo/influx-db/v1/response
MongoDB Bridge$CONTROL/cedalo/mongodb-bridge/v1$CONTROL/cedalo/mongo-db/v1/response

The following commands are currently available:

  • getSchema to get the schema used to validate the JSON config
  • getConfig to fetch current config as a JSON object
  • updateConfig to update the complete configuration of the respective bridge
  • getStatus to fetch information about current bridge status

Each control message has the following format:

{
"commands": [
{
"command": <A known control api command>,
"correlationData": <Optional UUID to identify sender. If specified it is passed with response.>,
"configChange": <Valid config JSON object>
}
]
}

getConfig

For example to fetch the current config send a getConfig command:

{
"commands": [
{
"command": "getConfig",
"correlationData": "1234"
}
]
}

The response depends on the type of bridge.

updateConfig

In order to update a bridge's configuration use the updateConfig command. The content of the configChange field depends on the bridge, you are trying to configure and is explained in detail in the specific bridge documentation Bridges Section. The following example presents a MQTT message payload that updates the config of the Azure EventHubs Bridge:

{
"commands": [
{
"command": "updateConfig",
"correlationData": "12345",
"configChange": {
"eventhubs": [
{
"name": "EvHub1",
"auth": {
"sas": {
"key": "A_SAS_Key_Token"
}
}
}
],
"producers": [
{
"name": "P1",
"hub": "hub1",
"eventhub": "EvHub1",
"options": {
"messageId": "{NOW_ISO}"
}
}
],
"topicMappings": [
{
"source": "test/topic",
"target": "P1"
}
]
}
}
]
}

getSchema

Example of getSchema:

{
"commands": [
{
"command": "getSchema",
"correlationData": "1234"
}
]
}

The response depends on the type of bridge and is explained in detail in the specific bridge documentation Bridges Section

Example of getStatus:

{
"commands": [
{
"command": "getStatus",
"correlationData": "1234"
}
]
}

The response depends on the type of bridge and is explained in detail in the specific bridge documentation Bridges Section