Send a message to the MQTT client utility by putting a message onto an IBM® WebSphere® MQqueue using IBM WebSphere MQ Explorer. The task shows you how to configure a remote
queue definition to send a message directly to an MQTT client.
About this task
The task demonstrates sending a message to an MQTT client
using queue rather than publishing to a topic. You do not create a
subscription in the client. Step 2 of
the task demonstrates that the previous subscription has been deleted.
Procedure
- Discard any existing subscriptions by disconnecting
and reconnecting the MQTT client utility.
The subscription
is discarded because, unless you change the defaults, the MQTT client
utility connects with a clean session; see Clean sessions.
To
make it easier to do the task, type your own ClientIdentifier,
rather than use the generated ClientIdentifier created
by the MQTT client utility.
- Click Disconnect to disconnect
the MQTT client utility from the telemetry channel.
The Client
History records a Disconnected
event
- Change the Client Identifer to MyClient.
- Click Connect.
The Client History records
a Connected
event
- Check that the MQTT client utility no longer
receives publication for the MQTTExampleTopic.
-
Click the Queue Managers\QmgrName\Topics folder in the
IBM WebSphere MQ Explorer.
-
Right-click MQTTExampleTopic > Test
publication...
-
Type Hello World! into the Message data field >
Publish message > Switch to the MQTT Client Utility
window.
No event is recorded in the Client history.
- Create a remote queue definition for the client.
Set
the ClientIdentifier, MyClient,
as the remote queue manager name in the remote queue definition. Use
any name you like as the remote queue name. The remote queue name
is passed to an MQTT client as the topic name.
- Right-click the Queue Managers\QmgrName\Queues folder
> New > Remote queue definition.
- Name the definition, MyClientRemoteQueue > Next.
- Type MQTTExampleQueue in the Remote
queue field.
- Type MyClient in the Remote
queue manager field.
- Type SYSTEM.MQTT.TRANSMIT.QUEUE in
the Transmission queue field > Finish.
- Put a test message onto MyClientRemoteQueue.
- Right-click MyClientRemoteQueue > Put
test message...
- Type Hello queue! into the Message
data field > Put message > Close
The Client history records a Received
event.
- Remove
SYSTEM.MQTT.TRANSMIT.QUEUE
as
the default transmit queue.
- Right-click the Queue Managers\QmgrName folder > Properties...
- Click Communication in the navigator.
- Remove
SYSTEM.MQTT.TRANSMIT.QUEUE
from
the Default transmission queue field > OK.
- Redo step 4.
MyClientRemoteQueue is a remote queue
definition that explicitly names the transmission queue. You do not
need a to define default transmission queue to send a message to MyClient.
What to do next
With the default transmission queue no longer set to SYSTEM.MQTT.TRANSMIT.QUEUE
,
the MQTT Client Utility is unable to create a new subscription unless
a queue manager alias is defined for the ClientIdentifier, MyClient.
Restore the default transmission queue to SYSTEM.MQTT.TRANSMIT.QUEUE
.