Publishing a message to the MQTT client utility from IBM MQ Explorer
Follow the steps in this task to publish a message using IBM® MQ Explorer, and subscribe to it with the MQTT client utility. An additional task shows you how to
configure a queue manager alias rather than setting the default transmission queue to
SYSTEM.MQTT.TRANSMIT.QUEUE
.
Before you begin
The task assumes that you are familiar with IBM MQ and the IBM MQ Explorer, and that IBM MQ and MQ Telemetry feature are installed.
The user creating the queue manager resources for this task must have sufficient authority to do so. For demonstration purposes, the IBM MQ Explorer user ID is assumed to be member of the mqm group.
About this task
Procedure
- You have installed MQ Telemetry, but you have not started it yet. Do the task: Start task with no telemetry (MQXR) service yet defined.
- You have run IBM MQ telemetry before, but want to use a new queue manager to do the demonstration. Do the task: Start task with no telemetry (MQXR) service yet defined.
- You want to do the task using an existing queue manager that has no telemetry resources
defined. You do not want to run the Define sample configuration wizard.
- Do one of the following tasks to set up telemetry:
- Do the task: Start task with a running telemetry (MQXR) service
- If you want to do the task using an existing queue manager that already has telemetry resources defined, do the task: Start task with a running telemetry (MQXR) service.
What to do next
Start task with no telemetry (MQXR) service yet defined
Create a queue manager and run the Define sample configuration to define sample telemetry resources for the queue manager. Publish a message using IBM MQ Explorer, and subscribe to it with the MQTT client utility.
About this task
When you set up sample telemetry resources using the Define sample
configuration, the wizard sets the guest user ID permissions. Carefully consider if you
want the guest user ID to be authorized in this way. guest
on Windows, and nobody
on Linux, are given permission to publish and subscribe to the
root of the topic tree, and to put messages onto SYSTEM.MQTT.TRANSMIT.QUEUE
.
The wizard also sets the default transmission queue to
SYSTEM.MQTT.TRANSMIT.QUEUE
, which might interfere with applications running on an
existing queue manager. It is possible, but laborious, to configure telemetry and not use the
default transmission queue; do the follow on task: Using a queue manager alias. In this
task, you create a queue manager to avoid the possibility of interfering with any existing default
transmission queue.
Procedure
Start task with a running telemetry (MQXR) service
Create a telemetry channel and a topic. Authorize the user to use the topic and the telemetry transmit queue. Publish a message using IBM MQ Explorer, and subscribe to it with the MQTT client utility.
Before you begin
In this version of the task, a queue manager, QmgrName
, is
defined and running. A telemetry (MQXR) service is defined and running. The telemetry (MQXR) service
might have been created manually, or by running the Define sample
configuration wizard.
About this task
In this task you configure an existing queue manager to send a publication to the MQTT client utility.
Step 1 of the task sets the default transmission
queue to SYSTEM.MQTT.TRANSMIT.QUEUE
, which might interfere with applications
running on an existing queue manager. It is possible, but laborious, to configure telemetry and not
use the default transmission queue; do the follow on task: Using a queue manager alias.
Procedure
Using a queue manager alias
Publish a message to the MQTT client
utility using IBM MQ Explorer without setting the default
transmission queue to SYSTEM.MQTT.TRANSMIT.QUEUE
.
The task is a continuation of the previous task, and uses a queue manager alias to avoid setting
the default transmission queue to SYSTEM.MQTT.TRANSMIT.QUEUE
.
Before you begin
Complete either the task, Start task with no telemetry (MQXR) service yet defined or the task, Start task with a running telemetry (MQXR) service.
About this task
When an MQTT client creates a subscription, IBM MQ sends its response using ClientIdentifier, as the remote queue manager name. In this task, it uses the ClientIdentifier, MyClient.
If there is no transmission queue or queue manager alias called MyClient,
the response is placed on the default transmission queue. By setting default transmission queue to
SYSTEM.MQTT.TRANSMIT.QUEUE
, the MQTT client gets the response.
You can avoid setting the default transmission queue to
SYSTEM.MQTT.TRANSMIT.QUEUE
by using queue manager aliases. You must set up a queue
manager alias for every ClientIdentifier. Typically, there are too many clients to
make it practical to use queue manager aliases. Often ClientIdentifier is
unpredictable, making it impossible to configure telemetry this way.
Nonetheless, in some circumstances you might have to configure the default transmission queue to
something other than SYSTEM.MQTT.TRANSMIT.QUEUE
. The steps in Procedure configure a queue manager alias instead of
setting the default transmission queue to SYSTEM.MQTT.TRANSMIT.QUEUE
.