Create a subscription to a topic using IBM® MQ Explorer and publish to the topic using MQTT client utility.
About this task
The task demonstrates publishing a message with an MQTT client and receiving the publication using an unmanaged
durable subscription created using IBM MQ Explorer.
Procedure
-
Create a durable subscription to the topic string
MQTT Example
.
Do the following steps to create the queue, and subscription using IBM MQ Explorer.
-
Right-click the Queue Managers\QmgrName\Queues folder
in the IBM MQ Explorer> New >
Local queue....
-
Type MQTTExampleQueue as the queue name >
Finish.
-
Right-click the Queue Managers\QmgrName\Subscriptions
folder in the IBM MQ Explorer> New >
Subscription....
-
Type MQTTExampleSubscription as the queue name >
Next.
-
Click Select... > MQTTExampleTopic >
OK.
-
Type MQTTExampleQueue as the destination name >
Finish.
-
As an optional step, set the queue up for use by a different user, without
mqm authority.
-
Authorize a user to put and get to the queue MQTTExampleQueue:
setmqaut -m qMgrName -t queue -n MQTTExampleQueue -p User ID -all +put +get
-
Publish
Hello IBM MQ!
to the topic
MQTT Example
using the MQTT client
utility.
If you have not left the MQTT client utility
connected, right-click the PlainText channel> Run MQTT Client Utility... >
Connect.
-
Type
MQTT Example
into the Publication\Topic
field.
-
Type
Hello IBM MQ!
into the
Publication\Message field> Publish.
-
Open the Queue Managers\QmgrName\Queues folder and find
MQTTExampleQueue.
The Current queue depth field is 1
-
Right-click MQTTExampleQueue > Browse messages...
and examine the publication.