[AIX][Windows][Linux]

Publishing a message to IBM MQ from an MQTT client

Create a subscription to a topic using IBM® MQ Explorer and publish to the topic using MQTT client utility.

Before you begin

Do the task, Publishing a message to the MQTT client utility from IBM MQ Explorer. Leave the MQTT client utility connected.

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

  1. Create a durable subscription to the topic string MQTT Example.
    Do the following steps to create the queue, and subscription using IBM MQ Explorer.
    1. Right-click the Queue Managers\QmgrName\Queues folder in the IBM MQ Explorer> New > Local queue....
    2. Type MQTTExampleQueue as the queue name > Finish.
    3. Right-click the Queue Managers\QmgrName\Subscriptions folder in the IBM MQ Explorer> New > Subscription....
    4. Type MQTTExampleSubscription as the queue name > Next.
    5. Click Select... > MQTTExampleTopic > OK.

      You have already created the topic, MQTTExampleTopic in step 4 of Publishing a message to the MQTT client utility from IBM MQ Explorer.

    6. Type MQTTExampleQueue as the destination name > Finish.
  2. As an optional step, set the queue up for use by a different user, without mqm authority.

    If you are setting up the configuration for users with less authority than mqm, you must give put and get authority to MQTTExampleQueue. Access to the topic and to the transmission queue was configured in Publishing a message to the MQTT client utility from IBM MQ Explorer.

    1. Authorize a user to put and get to the queue MQTTExampleQueue:
      
      setmqaut -m qMgrName -t queue -n MQTTExampleQueue -p User ID -all +put +get
      
  3. 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.

    1. Type MQTT Example into the Publication\Topic field.
    2. Type Hello IBM MQ! into the Publication\Message field> Publish.
  4. Open the Queue Managers\QmgrName\Queues folder and find MQTTExampleQueue.

    The Current queue depth field is 1

  5. Right-click MQTTExampleQueue > Browse messages... and examine the publication.