Machine-to-Machine (M2M) communication among different devices can be achieved by forwarding the desired message fields to another topic. You can enter the following topic information:
${productId}/house_monitor/thermometer
can forward messages satisfying the rule to this topic.${productId}/${house}/device
, where house
in ${}
represents a variable name, which is the content of the field selected in the SELECT statement.The following sample shows how a forwarding topic with variables works. Assume that the following rule is defined:
SELECT temperature as t, house
FROM house_monitor/thermometer/get
WHERE house="tencent" AND temperature > 40
This rule extracts the values of the t
and house
fields from the message. Assume that the content of the house
field is tencent
.
If you define forwarding to the house_monitor/${house}/app
topic, the rule engine will replace the ${house}
variable in this topic with tencent
and send the values of the t
and house
fields to the house_monitor/tencent/app
topic.
The entire forwarding process is as shown below:
IoT Hub will forward the reported data to this topic.
The quality of service (QoS) level of a message will not change when it is forwarded from the source topic to another topic.
Was this page helpful?