IBM MQ 8.0 was EOS 30th April 2020.Click EOS notice for more details
Transfer messages between the MQTT daemon for devices and IBM MQ
Do this task to learn how to send commands to the MQTT daemon for devices. The commands you write create a bridge that transfers messages from IBM® MQ to the daemon, and messages from the daemon to IBM MQ.
Before you begin
Note: The daemon for devices is no longer available. For an alternative solution, see the eclipse.org Mosquitto project
(https://eclipse.org/mosquitto).
The
task presumes you have defined a channel to the telemetry service
listening to port 1883 on address 127.0.0.1.
Likewise, the default daemon listener is configured to listen to port 1884 on
address 127.0.0.1. A single line in the configuration
file, which is stored in the same directory as the daemon, configures
the default daemon listener port.
port 1884
About this task
In this task, you update a running daemon to create a connection bridge to the IBM MQ telemetry (MQXR) service, and then exchange messages with the daemon.
Procedure
Make sure that you have two instances of the MQTT client utility running. One is connected to the daemon on port 1884, and one is connected to the telemetry channel running on port 1883.
Create the file, in the same directory as the daemon, with the following commands in the file.
connection daemon1
address 127.0.0.1:1883
topic # in import/ export/
topic # out export/ import/
try_private false
The bridge is called daemon1, and it connects to the channel configured for the telemetry (MQXR) service running at the socket address, 127.0.0.1:1883. The try_private command is optional; true is the default. Without this line, the bridge first tries to connect using a private protocol that is understood by the MQTT daemon for devices. Including try_private false in the commands avoids this step, and speeds up the time to finish a successful connection.
The line, topic # in import/ export/, instructs daemon1 to subscribe to all topics matching the topic string export/# created in the queue manager. It transfers the matching publications from the queue manager to the daemon, changing the start of the topic string from export/ to import/. The line, topic # out export/ import/, creates a subscription at the local daemon. The bridge subscribes to all topics matching the topic string export/# created in the daemon. It transfers publications from the daemon to the queue manager, changing the start of the topic string from export/ to import/.
In each instance of the MQTT client utility, type import/# in the Subscription/Topic: input field > Subscribe.
In each instance of the MQTT client utility, type export/# in the Publication/Topic: input field.
In the MQTT client utility connected to port 1883, the telemetry channel, type From the queue manager in the Publication/Message: input field > Publish.
In the MQTT client utility connected to port 1884, the MQTT daemon, type From the daemon in the Publication/Message: input field > Publish.
The client history in each MQTT client utility shows the publication that has been transferred from one broker to the other.