MQTTPublish policy

Use an MQTTPublish policy to control the value of specific MQ Telemetry Transport (MQTT) publishing properties at run time.

An MQTTPublish policy can be used to control the values of a specific set of MQTTPublish node properties, called operational properties, at run time. If a policy is attached to an MQTTPublish node, the property values that are specified in the policy are used at run time. These values override the property values that were specified when the message flow was developed. For information about which operational properties can be controlled by a MQTTPublish policy, see the MQTTPublish node reference topic.

You can use the following tools to create, attach, and manage MQTTPublish policies:
IBM® Integration Toolkit
Use the IBM Integration Toolkit to generate a policy document from an existing message flow node. The initial policy document contains the node's operational properties and the current values of those properties, as defined in the Properties view of the Message Flow editor. The operational property values can be edited as required, and the generated policy document can be saved in the Integration Registry. You can also use the IBM Integration Toolkit to attach and detach policies on the node. For more information, see Configuring MQEndpoint, MQTTSubscribe, or MQTTPublish policies with the IBM Integration Toolkit.
Web user interface (UI)
Use the web UI to create, retrieve, update, and delete policy documents that are stored in the Integration Registry. In the navigation tree, expand Operational Policy followed by the policy type; for example, expand MQTTPublish to see the list of saved policies that relate to MQTTPublish nodes. Select a policy name to view the contents of the policy document, and edit the property values as required. The Save As function enables you to save an existing policy with a new name.

You can also use the message flow view to retrieve and update a policy that is attached to a message flow node. In the navigation tree, expand Servers > server_name > resource, where server_name is the name of your integration server, and resource is where you stored your message flow. Then, expand Message Flows, and select the name of the message flow, or subflow, you want to view. Select the Operational Policy tab from the top of the message flow pane, and the message flow, or subflow, is displayed in the Node Policies section. If the message flow, or subflow, includes a node that has an operational policy attached, the following policy icon is displayed on the upper-right corner of the node icon: Image of policy icon.. Click the policy icon to retrieve and update the policy document.

For information about accessing the web UI, see Accessing the web user interface.

Representational State Transfer (REST) application programming interface (API)
Use the REST API to create, retrieve, update, and delete policy documents in the Integration Registry. For more information, see Representational State Transfer (REST) API.
Command line
Use the following commands to create, retrieve, update, and delete policy documents:
The following XML is an example of an MQTTPublish policy document:
<policy type="MQTTPublish">
    <policyProperties>
        <description>
            <shortDesc>Publish 01</shortDesc>
            <longDesc>MQTT publish policy for blood pressure monitor</longDesc>
        </description>
        <basic>
            <clientId>Pub_bloodpressure_1</clientId>
            <topicName>Hypertension/Alert</topicName>
            <hostName>localhost</hostName>
            <port>1883</port>
            <qos>0</qos>
        </basic>
    </policyProperties></policy>
Note: MQTT policy documents are specific to the type of MQTT node. For example, you can attach an MQTTPublish policy to any instance of an MQTTPublish node, but not to an MQTTSubscribe node.