Skip to content

Adapter - MQTT Client

This page describes version 2.0.8 of the adapter.

Overview

This adapter provides MQTT publish-subscribe-based messaging protocol. It is designed for connections with remote locations where a "small code footprint" is required or network bandwidth is limited. The publish-subscribe messaging pattern requires a message broker.



Properties

Name Display Is Required Comments Type Default Value Maximum Value Minimum Value Maximum Length Minimum Length
brokerAddress MQTT Broker Address True The host address of the MQTT Broker. string 1024 1
brokerPort MQTT Broker Port True The MQTT Broker port. integer 1883 65535 1
usetls Use TLS False Select to use a secure connection to the MQTT Broker. boolean true
clientId MQTT ClientID False The ClientID must be unique. The broker uses the client ID to identify the client and the current state of the client. string 1024 1
cleanSession Clean Session False Un-Check to establish a persistent connection with the broker. boolean true
userName Username False Username is required for authentication with MQTT Broker. string 1024
password Password False Password is required for authentication with MQTT Broker password 100
subscribeTopicName1 Subscribe Topic Name #1 False The MQTT Topic to subscribe to for messages. Requires a corresponding QoS value. string 1024
subscribeQos1 Subscribe QoS #1 False The Quality of Service Level (QoS) for the message. Valid values are 0, 1 and 2. string 1
subscribeTopicName2 Subscribe Topic Name #2 False The MQTT Topic to subscribe to for messages. Requires a corresponding QoS value. string 1024
subscribeQos2 Subscribe QoS #2 False The Quality of Service Level (QoS) for the message. Valid values are 0, 1 and 2. string 1
subscribeTopicName3 Subscribe Topic Name #3 False The MQTT Topic to subscribe to for messages. Requires a corresponding QoS value. string 1024
subscribeQos3 Subscribe QoS #3 False The Quality of Service Level (QoS) for the message. Valid values are 0, 1 and 2. string 1



Commands

Subscribe (subscribe)

Subscribes to an MQTT Topic for messages.

Request Properties

Name Display Description Is Required Type
topic Topic Name The MQTT Topic to subscribe to for messages. Requires a corresponding QoS value. True string
qos QoS The Quality of Service Level (QoS) for the message. Valid values are 0, 1 and 2. True string

Unsubscribe (unsubscribe)

Unsubscribes from an MQTT Topic.

Request Properties

Name Display Description Is Required Type
topic Topic Name The MQTT Topic to unsubscribe from. True string

Publish (publish)

Publishes an MQTT payload to a topic.

Request Properties

Name Display Description Is Required Type
topic Topic Name The topic of the message being sent. True string
payload Payload The data content of the message. False string
qos QoS The Quality of Service Level (QoS) for the message. Valid values are 0, 1 and 2. True string
retain Retain Tells the broker to store the last retained message and the corresponding QoS for a topic. False boolean

Events

MQTT Connected (mqttConnected)

The connection to MQTT Broker has been established.

No properties defined

messageArrived (messageArrived)

An MQTT message has arrived.

Event Properties

Name Display Description Type
data Data The payload data as Json. string
topic Topic Name The topic of the message received. string
payload Message Payload The data content of the message. string
qos Quality of Service Level The Quality of Service Level (QoS) for the message. string
retain Retain Indicates the last retained message and the corresponding QoS for a topic. string

Release History

Version Type Description Tracking # Date
2.0.1 Initial First release in the Adapter Type store.
2.0.5 Feature Added multiple subscription fields on the adapter properties. NAP-12579
2.0.7 Maintenance Updated third-party components and improved maintainability. NAP-11518
2.0.8 Maintenance Updated third-party components and improved maintainability. NAP-23945 2022-11-29

Categories