All Products
Search
Document Center

Link IoT Edge:Message routing examples

Last Updated:Jan 15, 2024

You can configure one or more message routes for each edge instance. This topic describes how to configure the five types of message routes that are supported by Link IoT Edge. It also provides details about how to view message route details.

For more information, see Configure message routing.

Message routes from devices to IoT Hub

After an edge instance is created, a default message route is configured for the edge instance. The message route starts from devices and ends with IoT Hub. The message route transfers all the messages about device properties and events to the cloud (IoT Hub). If the default route of an edge instance is deleted or you want to send the messages of a specific device to the cloud, you can add a route from the specific device to IoT Hub. This allows you to send the property data, event data, or all data of the specific device to the cloud.

If you configure a message route as follows, the property data and event data of the Light device are sent to the cloud. If device data fails to be sent due to network errors, Link IoT Edge stores the device data in a local storage location. After network connections are reestablished, Link IoT Edge sends the local data to the cloud.

Message routing

After the device data that meets the specified topic filtering condition is sent to the cloud, you can view the reported device data on the Device Log page of the IoT Platform console. On the Device Log page, you must select the product to which the device belongs.

Message routes from devices to edge applications

You can use message routes of this type to send device property data or all device data (property data and event data) to the specified edge applications.

Important

In the configurations of message routing, you can select only the edge applications that are created by using Function Compute.

If you configure a message route as follows, the property data of the Light device is sent to the specified edge application: lightSensorDataFilter.

Message routing

The data that is routed to the specified edge application is not sent to the cloud. Therefore, you can view the reported data only in the local operations log of the gateway device. You can run the tail command to view the local operations log of the gateway device. The valid format of the command is tail -f /linkedge/run/logger/fc-base/{module name}/log.INFO. In this format, the {module name} variable indicates your module name. For example, you can run the tail -f /linkedge/run/logger/fc-base/function-compute/log.INFO command. In this command, function-compute is the name of the Function Compute-based edge application module.

Message routes from edge applications to IoT Hub

You can use message routes of this type to send data from edge applications to the cloud.

Important

In the configurations of message routing, you can select only the edge applications that are created by using Function Compute.

If you configure a message route as follows, the lightSensorDataFilter edge application filters message topics based on the /productkey/devicename/user/# topic category. Then, the edge application sends the messages that belong to the message topics in the topic category to the cloud. If network errors occur, Link IoT Edge uses a local storage location to store the data that fails to be sent to the cloud. After network connections are reestablished, Link IoT Edge sends the local data to the cloud.

Note

/productkey/devicename/user/# is a custom topic category that you have created in the IoT Platform console. The messages that belong to the topic category are sent to the cloud (IoT Hub). For more information, see Use custom topics for communication.

Message routing

After the data from the edge application is sent to the cloud, you can view the reported data on the Device Log page of the IoT Platform console. On the Device Log page, you must select the product to which the instance gateway device belongs.

Message routes from Edge Application A to Edge Application B

You can use message routes of this type to send data from Edge Application A to Edge Application B.

Important

In the configurations of message routing, you can select only the edge applications that are created by using Function Compute.

If you configure a message route as follows, Edge Application A filters message topics based on the /xxxx topic category. Then, Edge Application A sends the messages that belong to the message topics in the topic category to Edge Application B.

Message routing

You can view the data that is sent to edge applications only in the local operations log of the gateway device. For more information, see Message routes from devices to edge applications.

Message routes from IoT Hub to edge applications

You can use message routes of this type to send data from the cloud to edge applications.

Important

In the configurations of message routing, you can select only the edge applications that are created by using Function Compute.

If you configure a message route as follows, IoT Hub filters message topics based on the /productkey/devicename/user/# topic category. Then, IoT Hub sends the messages that belong to the message topics in the topic category to the specified edge application.

Note

IoT Hub sends the messages that belong to the message topics whose names start with /$Your_ProductKey/$Your_DeviceName/user to the edge application.

From the cloud to the edge application

You can view the data that is sent to edge applications only in the local operations log of the gateway device. For more information, see Message routes from devices to edge applications.