Use the MQTT client utility
Use one or more MQTT client utilities to test your telemetry setup. Within the scope of this task, one client utility is used to publish and subscribe to messages.
Before starting
- Make sure that the telemetry (MQXR) service is running.
- You need at least one running telemetry channel to successfully use the MQTT client utility.
About this task
There are several methods to start the MQTT client utility. For more information about running the client utility, see Running the MQTT client utility. Within the scope of this task, the client utility is started from the PlainText telemetry channel created with the Define sample configuration wizard.By default, the MCA user ID of the PlainText channel is set to guest on Windows, and nobody on Linux . You need these default values in order to subscribe to topics.
Procedure
- Right-click the PlainText telemetry channel, then click Run MQTT Client Utility. The client utility window opens. The Host and Port fields are automatically set using values from the selected telemetry channel.
- Type a client ID in the Client identifier field. A new client identifier is generated each time you launch an MQTT client utility from a telemetry channel. We can either use the generated identifier or type a name of our choice. If you run more than one client utility on a telemetry channel, ensure that we use different client IDs for each client utility. If two MQTT client utilities have the same client ID, the most recent one to connect forcefully disconnects the previous one. When you run more than one MQTT client utility from a telemetry channel, the generated client identifier has a numeric suffix that is incremented every time a new client utility is started.
- Click Options to open the Connection Options window. We can start the client utility with a clean session, or configure the last will and testament options.
- Click Connect to establish a connection with the PlainText telemetry channel. A new event entry of Connected is displayed in the Client history.
- Type a topic name in the Subscription Topic field. The default topic name is testTopic and this name is used throughout this task.
- Select the subscription quality of service from the Request QoS menu.
- Click Subscribe to subscribe to the topic testTopic. A new event entry of Subscribed is displayed in the Client history, along with the topic name, QoS, and the time of subscription.
- Accept the default topic name, testTopic, in the Publication Topic field. In general, ensure that the subscription and publication topics match so that the MQTT client receives messages from the correct topic.
- Type a message in the Message field. The default message test is Test Message.
- Select the publication quality of service from the Request QoS menu.
- Select Retained to forward the most recent retained publication on this topic to new subscribers.
- Click Publish to publish the message on the testTopic topic for interested subscribers. A new event entry of Published is displayed in the Client history, along with the topic name, QoS, whether the message is retained, and the time of subscription. On the receiving client utility, a new event entry of Received is displayed in the Client history.
- Select the received message in the Client history, then click View message to view the full message in the Message Viewer window. Alternatively, select the message and press Enter, or double-click the received message.
Results
Publishing messages and viewing the messages from topics subscribed to, shows that we have correctly set up your queue manager for Telemetry.
Parent topic: MQTT client utility
Related concepts
Related tasks
- Resolving problems if your MQTT client fails to connect
- Resolving problems if your MQTT client disconnects unexpectedly