Integration Server 10.5 | Built-In Services Reference Guide | MQTT Folder | pub.mqtt:publish
 
pub.mqtt:publish
WmPublic. Publishes an MQTT message to an MQTT server.
Input Parameters
connectionAliasName
String Name of the MQTT connection alias to use to send the MQTT message.
topicName
String Name of the topic to which to publish the message.
MqttMessage
Document Document (IData object) A document representing the MQTT message to publish to the MQTT server.
Key
Description
payload
Document Optional. A document containing the MQTT message payload. Integration Server supports the following formats for the message payload. If you do not specify a payload, the service sends an empty byte[].
Key
Description
string
String Optional. Message body in the form of a String.
bytes
byte [ ] Optional. Message body in the form of a one-dimensional byte array.
qos
String Optional. The quality of service (QoS) for publishing the message to the MQTT server.
Specify one of the following:
*0 At most once. Integration Server publishes the message to the MQTT server once or not at all.
*1 At least once. Integration Server publishes the message to the MQTT server one or more times. This is the default.
*2 Exactly once. Integration Server publishes the message to the MQTT server once and only once.
The QoS for publishing messages to the MQTT server is separate from the QoS for receiving messages. As a result, it is possible for a message to be published to the MQTT server with a higher QoS than which the message is received from the MQTT server.
isRetained
String Optional. Flag indicating whether the MQTT server retains the published message as the last known message for the topic.
Set to:
*true to indicate the message is to be retained by the MQTT server as the last known message for the topic.
*false to indicate the MQTT server will not retain this message as the last known message for the topic. This is the default.
Output Parameters
None.
Usage Notes
Integration Server relies on Paho to determine the max inflight property value. The max inflight property determines the maximum number of messages that can be published to the MQTT server at one time using the same MQTT connection alias. Paho uses a default of 10. However you can use the watt.server.mqtt.producer.maxInflight server configuration parameter to set the max inflight property value.