The "configureBrokerConnection" creates or updates a reusable connection to an external broker, which may be another instance of FairCom MQ, FairCom Edge, or an MQTT broker from another vendor. It stores this information in the "mqtt_broker" table inside the embedded FairCom database. There is one record for each connection to an external MQTT broker.
- The
"brokerConnectionName"is a unique user-defined name for the connection. It may be up to 100 characters long. It is used in all subsequent references to the connection, such as when configuring a topic to subscribe or forward messages to an external broker or when altering or deleting a broker connection. - If the
"brokerConnectionName"already exists, then when running"configureBrokerConnection"FairCom's servers update the record rather than creating it. - Care should be taken when editing an existing broker connection because multiple MQTT topics may use it.
- If you do not wish to share a broker connection between multiple topics/integration tables (so you can control the broker connections independently), it is permissible to create multiple broker connections which all connect to the same external MQTT broker - giving each broker connection record a different
"brokerConnectionName".
Request examples
Minimal
{
"action": "configureBrokerConnection",
"params": {
"brokerConnectionName": "MqttBroker1",
"brokerHostname": "mqtt.faircom.com"
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}Maximal
{
"api": "mq",
"apiVersion": "1.0",
"requestId": "2",
"action": "configureBrokerConnection",
"params": {
"brokerConnectionName": "MqttBroker1",
"brokerHostname": "mqtt.faircom.com",
"brokerPort": 1883,
"brokerUserName": "admin",
"brokerUserPassword": "admin",
"reconnectFrequencySeconds": 20,
"command": "disconnect",
"tls": {
"allowedCipherSuites": "",
"certificateAuthoritiesFilename": "",
"certificateFilename": "",
"privateKeyFilename": ""
},
"metadata": {}
},
"authToken": "replaceWithAuthTokenFromCreateSession"
}
Response examples
Minimal
{
"result": {},
"errorCode": 0,
"errorMessage": ""
}Maximal
{
"result": {},
"requestId": "2",
"errorCode": 0,
"errorMessage": ""
}
Properties
Request properties ("params")
| Property | Description | Default | Type | Limits (inclusive) |
|---|---|---|---|---|
brokerConnectionName |
The
|
Optional with default of ""
|
string | 1 to 100 bytes |
brokerHostname |
The When these rules are violated the following errors will be displayed:
|
Required - No default value |
string | 1 to 255 bytes |
brokerPort |
The
|
Optional with default of 1883
|
integer |
|
brokerUserName |
The
|
Optional with default of |
string | 1 to 64 bytes |
brokerUserPassword |
The
Example {
"encryption": "NONE",
"password": "myPassword"
} |
Optional with default of |
string | 0 to 256 bytes |
command |
The The following service commands are available:
|
Optional with default of |
string |
|
metadata |
The "metadata" property contains user-defined properties that add keywords and tags about the code package. The server indexes this field with a full-text index so you can search for any word or phrase to find code packages. |
Optional with default of {}
|
object | 0 or more key/value pairs |
reconnectFrequencySeconds |
The If it is set to FairCom's servers attempt to connect to an external broker when it is configured as a subscriber to topics on an external broker or when it is configured to forward messages to an external broker. To stop the reconnect process, send the To restart the reconnect process, send the |
Optional with default of 15
|
int32 |
|
tls |
The "tls" property defines the public server certificate filename, the private key filename, the certificate authority filename, the cipher suites that are allowed, and whether the client certificate is required. |
Optional with default of {}
|
object |
|
|
tls .allowedCipherSuites |
The
|
Optional with default of ""
|
string | No limits |
|
tls .certificateAuthoritiesFilename |
The "certificateAuthoritiesFilename" property specifies the name and optional path of the certificate authorities certificate file (such as "ca.pem"). |
Optional with default of ""
|
string | No limits |
|
tls .certificateFilename |
The "certificateFilename" property specifies the name and optional path of a server certificate file. |
Optional with default of ""
|
string | No limits |
|
tls .privateKeyFilename |
The "privateKeyFilename" property specifies the name and optional path of a server key file. |
Optional with default of ""
|
string | No limits |