MQTT Export Service

Content

  • Introduction

  • Register MQTT export service

  • MQTT X setup

Introduction

MQTT Export Service is provided the application to get EdgeX data via the MQTT protocol.

EdgeX data flow for MQTT Export service is shown below. The core data micro service provides centralized persistence for data collected by devices services and it allows the data to be distributed to the Export Services via MQTT.

In this demo we look at subscribing using the MQTT X client to get EdgeX data. Here are the steps:

  • Register MQTT export service: create and register mqtt export service.

  • MQTT X setup: used MQTT 5.0 desktop client on Windows. To follow MQTT export service setup data to configure a new client connection on MQTT X client. After the Topic is successfully subscribed, you can immediately receive EdgeX message in the message box. Beside, you can test by posting individual data values using Postman.

Register MQTT export service

1.Edit “create_mqtt_export_register.bat”

2.Register MQTT export service that execute “create_mqtt_export_register.bat” and “mqtt_export_register.bat”.

MQTT X setup

1.Click below Link and download MQTT 5.0 desktop client on Windows. https://github.com/emqx/MQTTX/releases

2.Click + in the left menu bar or directly click the “+ New Connection” button on the right to configure a new client connection.

3. Client related information. (1) General: a. When configuring the broker information, fill in Name and follow above Table 1 to fill in Host address. Ex.10.0.75.1.

b. Client ID, Host, and Port are already filled in by default. The drop-down box in front of Host is used to select the connection protocol, which supports mqtt: //, ws: //. If an SSL / TLS authentication connection is used, it needs to be modified to mqtts: //. , Wss: //.

c. If your broker has enabled user authentication, you can fill in the information of Username and Password in the configuration item. d. To disable SSL/TLS

d. To disable SSL/TLS

(2) Advanced: In the advanced configuration, you can select the protocol version of MQTT, including MQTT v3.1.1 and MQTT v5.0, and the default is v3.1.1.

(3) Last Will and Testament: Below the advanced configuration, you can configure the Will Message. The values of Last-Will-QoS and Last-Will-Retain are filled with 0 and False by default. When you enter the values of Last-Will-Topic and Last-Will-Payload, you can complete the configuration of Will Message.

(4) Click “Connect”

1.Add subscription (1) Click the New Subscription button in the lower left corner to quickly add a Topic.

(2) Click the New Subscription button in the lower left corner to quickly add a Topic. Follow above Table 1 to fill in Topic: MQTTExport

5. Sending and receiving of messages

(1) After the Topic is successfully subscribed, you can immediately receive EdgeX messages per 20 seconds automatically.

(2) In addition to the above method of automatically to send EdgeX data, the functionality can be tested by posting individual data values using Postman, and then via MQTTX client to check the information from EdgeX.

Last updated