Edge Nodes Reporting Messages to the Cloud
Scenario
IEF allows edge nodes to report messages to the cloud.
You can publish data to a custom topic in SystemEventBus (MQTT broker) of edge nodes. IEF forwards the data to a DIS stream or an API Gateway address. Then, you can extract the data for processing and analysis.
This section uses the DIS endpoint as an example. The method of using the API Gateway endpoint is similar. The procedure is as follows:
Creating an Endpoint
- Log in to the IEF console, and click Switch Instance on the Dashboard page to select a platinum service instance.
- In the navigation pane, choose Edge-Cloud Messages > Endpoints.
- Click Create Endpoint in the upper right corner. Select DIS for Type, and enter an endpoint name.
Figure 1 Creating an endpoint
- Click OK.
Buying a DIS Stream
Before sending messages to DIS, buy a DIS stream.
- Log in to the DIS console.
- Click Buy Stream in the right corner and set parameters.
Figure 2 Buying a DIS stream
- Click Next, confirm the product specifications, and click Submit.
Creating a Route
- Log in to the IEF console, and click Switch Instance on the Dashboard page to select a platinum service instance.
- In the navigation pane, choose Edge-Cloud Messages > Routes.
- Click Create Route in the upper right corner.
- Set parameters.
Figure 3 Creating a route
- Name: Enter a route name.
Message routes and system subscriptions are of the same resource type. Their names cannot conflict with each other.
- Source Endpoint: Select SystemEventBus.
- Source Endpoint Resource: Select Custom topic, select the edge node that will send messages, and enter a topic name.
- Destination Endpoint: Select the endpoint created in Creating an Endpoint.
- Destination Endpoint Resource: Select the DIS stream purchased in Buying a DIS Stream.
- Record the topic, as shown in the red box in the preceding figure. After the route is created, you can view the topic in the Source Endpoint column of the route list.
- After customizing a topic, you need to use the complete topic (marked in red in the figure above) for messaging.
- Name: Enter a route name.
- Click Create.
Sending a Message
Use the MQTT client on the edge node to send messages.
In this example, the message needs to be published to the topic specified in Creating a Route. As shown in the following figure, mosquitto_pub is used to send a message.
[root@ief-node ~]# mosquitto_pub -t '05e1aef9040010e22fccc009adecb056/nodes/7092ad14-adee-4a09-b969-1505bbdecef5/user/aaa' -d -m '{ "edgemsg": "msgToCloud"}' Client mosq-p5LouPQIW2gx0JPkRF sending CONNECT Client mosq-p5LouPQIW2gx0JPkRF received CONNACK (0) Client mosq-p5LouPQIW2gx0JPkRF sending PUBLISH (d0, q0, r0, m1, '05e1aef9040010e22fccc009adecb056/nodes/7092ad14-adee-4a09-b969-1505bbdecef5/user/aaa', ... (26 bytes)) Client mosq-p5LouPQIW2gx0JPkRF sending DISCONNECT
After the message is sent, you can view the Forwarded Messages column in the route list to check whether the message is successfully forwarded by the route.
You can view incoming messages on the DIS console.
Obtaining Data
After data is forwarded to DIS stream, you can extract the data for processing and analysis. For details on how to obtain data from DIS, see Obtaining Data from DIS.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot