The Xentara MQTT client v2.0
User Manual
JSON Format for Clients

A JSON object describing an MQTT client element has the following syntax:

{
"@Skill.MQTT.Client": {
"name": "MQTT Client",
"UUID": "982e5808-a7c8-4c28-86ed-1cbc3d882376",
"ACL": { ... },
"brokerAddress": "mqtt.mycompany.com",
"TLS": {
...
},
"MQTTVersion": "5",
"clientID": "Xentara",
"username": "xentara",
"password": "LHuBDQa3JqeUZbfdE3yN7fDTmWbMZeTN",
"keepaliveInterval": "5min",
"birth": {
...
},
"will": {
...
},
"children": [
...
]
}

Object Members
nameA string value containing the name of the client. The name is used to construct the client’s primary key.
UUIDA string value containing the unique UUID of the client.
ACLAn optional JSON object containing the element ACL of the client. The format of the object is described under JSON Format for ACLs in the Xentara user manual.
brokerAddress

A string value containing the network address of the broker to connect to. This can be a host name or an IP address, with or without a port number. If the address does not contain a port number, then the standard MQTT port will be used. The standard MQTT port is 8883 for secure (TLS) connections, and 1883 for insecure (non-TLS) connections.

The format of the string is described under JSON Format for Network Addresses in the Xentara user manual.

TLS

An optional JSON object describing the TLS configuration for secure broker connections. The format of the block is described here.

If you do not specify this parameter, then an insecure, unencrypted connection will be used.

clientIDAn optional string value containing the MQTT client identifier the client should advertise to the broker on connection. The client identifier must not be empty. If you do not specify this parameter, a suitable client identifier will be generated by Xentara.
MQTTVersionAn optional string value containing the MQTT protocol version to use. Must be one of "5", "3.1.1", or "3.1". If you do not specify this parameter, then MQTT version 5 will be used.
usernameAn optional string value containing the username to use for the MQTT connection. If you do not specify this parameter, then no username will be used.
password

An optional string value containing the password to use for the MQTT connection. If you do not specify this parameter, then no password will be used.

Please note than MQTT versions 3.1.1 and 3.1 do not support a password without a username. If you specified "3.1.1" or "3.1" as MQTT version, then a password can only be specified if a username is also specified.

keepaliveInterval

An optional string value containing the interval at which Xentara sends keep-alive messages to the broker if no other traffic was sent. The keepalive interval must not be less than 5s. The format of the string is described under JSON Format for Time Intervals in the Xentara user manual.

If you do not specify this parameter, then a keepalive interval of 60s will be used.

birth

An optional JSON object describing the birth message to be sent. The format of the block is described here.

If you do not specify this parameter, then no birth message will be sent.

will

An optional JSON object describing the will message to be sent. The format of the block is described here.

If you do not specify this parameter, then no will message will be sent.

children

A JSON array containing the topics of the client.

The individual child elements are each represented by a double nested JSON object, as described in Element Blocks under Structure of the Model File in the Xentara user manual. The outer object has a single member whose name is the type of element, and whose value is another JSON object that contains the actual properties of the element.

TLS Configuration

A JSON object describing the TLS configuration for an MQTT client has the following syntax:

"TLS": {
"enabled": true,
"clientCertificate": {
...
},
"serverCertificate": "mqtt-server.pem"
}

Object Members
enabledAn optional Boolean value specifying whether to establish a secure connection using TLS or not. If you do not specify this parameter, then an insecure, unencrypted connection will be used.
clientCertificate

An optional JSON object containing the paths to the client certificate and private key file to present to the broker. The format of the object is described under JSON Format for Certificates in the Xentara user manual.

If you do not specify this parameter, then no client certificate will be presented.

serverCertificate

An optional string value containing the path to the server certificate the broker is expected to present. The certificate file is searched for as described under Certificate File Location. The certificate file must be a PEM encoded file containing the certificate, as described in Certificate And Private Key File Structure.

This member should only be specified if the certificate of the broker is untrusted, or if it contains the wrong hostname. Server certificates issued by a trusted certificate authority are automatically accepted, even without this parameter. See Certificates for details.

If you specify this parameter, then the certificate presented by the broker must match the specified certificate exactly.

Birth Configuration

A JSON object describing the birth message for an MQTT client has the following syntax:

"birth": {
"topic": "xentara/birth",
"payload": ...,
"extraAttributes": [
"changeTime",
"error"
],
"QoS": 0,
"retained": false
}

Birth Members
topicA string value containing the topic of the birth message. This can, but need not, be shared with one of the topic elements of the client. See 3.1.3.3 Birth Topic in the MQTT specification for details.
payload

A JSON string value or a JSON object containing the payload of the birth message. The format of the value is described under JSON Format for Message Payloads.

See 3.3.3 PUBLISH Payload in the MQTT specification for details.

extraAttributes

An optional JSON array containing additional attributes that should be included in data point value payloads. The value and quality attributes are always included automatically, and must not appear in the array.

It is not considered an error if the data point included in the payload does not provide all of the additional attributes. Any attributes not provided by the data point will simply be omitted from the payload. This allows you to include attributes like “error” or “writeTime” in this list, that may not be supported by all data points.

QoS

An optional numeric value containing the quality of service to use for the birth message. The QoS must be 0, 1, or 2. See 3.3.1.2 QoS in the MQTT specification for details.

If you do not specify this parameter, then a QoS of 0 will be used.

retained

An optional Boolean value specifying whether the birth message should be retained by the broker. See 3.3.1.3 RETAIN in the MQTT specification for details.

If you do not specify this parameter, then the birth message will not be retained.

Will Configuration

A JSON object describing the will message for an MQTT client has the following syntax:

"will": {
"topic": "xentara/will",
"payload": ...,
"QoS": 0,
"retained": false,
"abnormalDisconnectOnly": false
}

Object Members
topicA string value containing the topic of the will message. This can, but need not, be shared with one of the topic elements of the client. See 3.1.3.3 Will Topic in the MQTT specification for details.
payload

A JSON string value or a JSON object containing the payload of the will message. The format of the value is described under JSON Format for Message Payloads.

Please note that an MQTT broker will not forward or retain any message with an empty payload. An empty will payload is useful to instruct the broker to discard a retained message, as described in Using the Will to Discard Stale Messages.

See 3.1.3.4 Will Payload in the MQTT specification for details.

QoS

An optional numeric value containing the quality of service to use for the will message. The QoS must be 0, 1, or 2. See 3.1.2.6 Will QoS in the MQTT specification for details.

If you do not specify this parameter, then a QoS of 0 will be used.

retained

An optional Boolean value specifying whether the will message should be retained by the broker. See 3.1.2.7 Will Retain in the MQTT specification for details.

If you do not specify this parameter, then the will message will not be retained.

abnormalDisconnectOnly

An optional Boolean value specifying whether the will message should be sent on abnormal disconnect only. If you enable this option, then no will message will be sent if Xentara is shut down normally.

If you do not specify this parameter, then the will message will be sent on normal and abnormal disconnect.

Note
Configurations for the Xentara MQTT client prior to version 2.0 used "lastWill" rather than "will" to configure the will options. If the last will configuration block name is "lastWill", this parameter is automatically enabled to maintain backwards compatibility with the behaviour of older versions of the Xentara MQTT client, which never sent the will message on normal disconnect.