MQTTSubscribe policy

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

An MQTTSubscribe policy can be used to control the values of a specific set of MQTTSubscribe node properties, called operational properties, at run time. If a policy is attached to an MQTTSubscribe 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 an MQTTSubscribe policy, see the MQTTSubscribe node reference topic.

You can use the following tools to create, attach, and manage MQTTSubscribe 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 MQTTSubscribe to see the list of saved policies that relate to MQTTSubscribe 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 MQTTSubscribe policy document:
<policy type="MQTTSubscribe">
    <policyProperties>
        <description>
            <shortDesc>Subscribe 01</shortDesc>
            <longDesc>MQTT subscribe policy for blood pressure monitor</longDesc>
        </description>
        <basic>
            <clientId>Sub_bloodpressure_1</clientId>
            <topicName>Hypertension/Emergency</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 MQTTSubscribe policy to any instance of an MQTTSubscribe node, but not to an MQTTPublish node.