+

Search Tips | Advanced Search

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 you begin


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

  1. 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.
  2. 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 your 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.
  3. 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.
  4. Click Connect to establish a connection with the PlainText telemetry channel. A new event entry of Connected is displayed in the Client history.
  5. Type a topic name in the Subscription Topic field. The default topic name is testTopic and this name is used throughout this task.
  6. Select the subscription quality of service from the Request QoS menu.
  7. 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.
  8. 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.
  9. Type a message in the Message field. The default message test is Test Message.
  10. Select the publication quality of service from the Request QoS menu.
  11. Select Retained to forward the most recent retained publication on this topic to new subscribers.
  12. 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.
  13. 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.