Publish a message to a specific MQTT v3 client
Publish a message from one MQTT v3 client to another, using ClientIdentifier as the topic name and IBM® MQ as the publish/subscribe broker.
Before you begin
About this task
- Subscribing to a topic in one MQTT client, and receiving a publication from another MQTT client.
- Setting up "point-to-point" subscriptions by using ClientIdentifier as the topic string.
Mosquittoproject (https://eclipse.org/mosquitto).
Procedure
Results
The Client history in the MQTT client utility with the ClientIdentifier, MyClient, records two Received events and one Published event. The other MQTT client utility instance records one Published event.
- Is the default transmission queue for the queue manager set to
SYSTEM.MQTT.TRANSMIT.QUEUE
? - Have you created queue manager aliases or remote queue definitions referencing MyClient in doing the other exercises? In case you have a configuration problem, delete any resources that reference MyClient, such as a queue manager aliases or transmission queues. Disconnect the client utilities, stop, and restart the telemetry (MQXR) service.
What to do next
Do the next task, Using the MQTT daemon for devices as the publish/subscribe broker. The MQTT client utility connects to the MQTT daemon for devices rather than to a telemetry channel.
Using the MQTT daemon for devices as the publish/subscribe broker
Use the MQTT daemon for devices as the publish/subscribe broker instead of IBM MQ. Publish a message with one instance of the MQTT client utility to send to another instance, by subscribing using its ClientIdentifier as a topic string.
Before you begin
Mosquittoproject (https://eclipse.org/mosquitto).
Install the MQTT daemon for devices, if you have not done so already.
Do not run the verification; it uses port 1883, which is already in use by the PlainText telemetry channel.
About this task
In the task, you connect MQTT clients to the MQTT daemon for devices using a non-default TCP/IP port. One client subscribes using its ClientIdentifier as a topic string, and the other client publishes to ClientIdentifier, exactly in the same way as in the previous task, see Procedure.
Procedure
Results
The Client history in the MQTT client utility with the ClientIdentifier, MyClient, records two Received events and one Published event. The other MQTT client utility instance records one Published event.
You can also monitor the connection and disconnection events to the MQTT daemon for devices in the command window.