MQTT publish/subscribe applications
Use topic-based publish/subscribe to write MQTT applications.
When the MQTT client is connected, publications flow in either direction between the client and server. The publications are sent from the client when information is published at the client. Publications are received at the client when a message is published to a topic that matches a subscription created by the client.
The IBM MQ publish/subscribe broker manages the topics and subscriptions created by MQTT clients. The topics created by MQTT clients share the same topic space as topics created by IBM MQ applications.
Publications that match the topic string in an MQTT client subscription are placed on SYSTEM.MQTT.TRANSMIT.QUEUE with the remote queue manager name set to the ClientIdentifier of the client. The telemetry (MQXR) service forwards the publications to the client that created the subscription. It uses ClientIdentifier, which has been set as the remote queue manager name to identify the client.
Typically, SYSTEM.MQTT.TRANSMIT.QUEUE must be defined as the default transmission queue. It is possible, but onerous, to configure MQTT not to use the default transmission queue; see Configure distributed queuing to send messages to MQTT clients.
An MQTT client can create a persistent session; see MQTT stateless and stateful sessions. Subscriptions created in a persistent session are durable. Publications that arrive for a client with a persistent session are stored in SYSTEM.MQTT.TRANSMIT.QUEUE, and forwarded to the client when it reconnects.
An MQTT client can also publish and subscribe to retained publications; see Retained publications and MQTT clients. A subscriber to a retained publication topic receives the latest publication to the topic. The subscriber receives the retained publication when it creates a subscription, or when it reconnects to its earlier session.
Parent topic: MQ Telemetry overview