2.5. Test MQTT

Here is a quick way to test both the DataHub MQTT Broker and MQTT Client, by connecting them to each other.

Configure the MQTT Broker

  1. In the Properties window, select MQTT Broker.

  2. In the Point Names options, check the Place all points in this data domain box, and enter MQTTBroker for the domain name.

  3. Click Apply.

The DataHub MQTT Broker is now ready to accept MQTT client connections for the MQTTBroker domain. For more information about the MQTT Broker feature, please refer to Section 3.13, “MQTT Broker”.

Configure the MQTT Client

  1. In the Properties window, select MQTT Client.

  2. Click the Add button to open the Connect to MQTT Broker window:

  3. In the Standard MQTT section, Connection tab, enter the following:

    • Label: TestMQTTMv

    • Host: localhost

    • Port: 1883 (the default)

    • Keepalive: 30 (the default)

    • Retry rate: 5000 (the default)

    • Maximum update rate: 0 (the default).

  4. In the Push data points to the MQTT broker section, Available Points list, open the DataPid tree and select the point Mv. (If you don't see the DataPid domain, start DataPid.)

  5. Click the MQTTBroker domain in the domain list to highlight it.

  6. Click OK, and then Apply.

  7. Click the View Data button in the Properties window to open the Data Browser. In the MQTTBroker domain you should see the value for DataPid.Mv updating.

You have now configured the DataHub MQTT Client to send a value to the DataHub program via the MQTT Broker. For more information about the MQTT Client feature, please refer to Section 3.12, “MQTT Client”.