Attach an MQTTSubscribe policy to one or more MQTTSubscribe nodes in a message flow to control the value of specific MQ Telemetry Transport (MQTT) subscription properties at run time.
You use the MQTTPublish node to publish messages that are generated in your message flow to a topic that is hosted on an MQTT server. The published messages are then delivered by the MQTT server to all topic subscribers. You can use an MQTTSubscribe node to receive messages from an MQTT server. You can attach an MQTTSubscribe policy to an MQTTSubscribe node to control, at run time, how the node receives messages from the MQTT server.
To attach an MQTTSubscribe policy to an MQTTSubscribe node, set the Policy property of the MQTTSubscribe node to the name of the policy, in the format {policyProjectName}:policyName. You must deploy this policy before the associated message flow is started.
Property | Property name in .policyxml file | Value |
---|---|---|
Client ID | clientId | This property specifies the unique name of the client. The client ID is a string of 1 - 23 characters that identifies an MQTT client to an MQTT server. If you specify a client ID that is longer than 23 characters, only the last 23 characters are used when the MQTT node connects to the MQTT server. Each client that is connecting to a single server must use a unique client ID. If a client attempts to connect to an MQTT server with a client ID that is already in use, the server disconnects the first client connection, and accepts the new connection instead. Therefore, at deployment time, you must ensure that any MQTT nodes that are connecting to the same server have unique client IDs. Value type: String |
Topic name | topicName | This property specifies the name of the MQTT topic where the MQTTSubscribe node subscribes to receive messages. Value type: String |
Host name | hostName | This property specifies the host name for the MQTT server where the MQTTSubscribe node subscribes to receive messages. Value type: String |
Port number | port | This property specifies the port number that is used to connect to the MQTT server. This
property has a default port number of 1883. Value type: Integer |
Quality of service (QoS) | qos | This property specifies the quality of service level for the delivery of MQTT messages (see
Quality of service and connection management). The following values are valid:
Value type: Integer |
Security identity (DSN) | securityIdentity | This property specifies the name of the security identity object that is created by the
mqsisetdbparms command. The security identity contains the
user ID and password that is used to authenticate the connection to the MQTT server (see mqsisetdbparms command). Value type: String |
Use SSL | useSSL | This property specifies whether the connection between the MQTTSubscribe node and the MQTT server is secured by using SSL
(see Securing MQTT connections). This property has a default value of
False, which means that SSL is not used. Value type: Boolean |