You need to enable JavaScript to run this app.
Cloud Native Message Engine

Cloud Native Message Engine

Copy page
Download PDF
Best practices
Device status reporting to Kafka
Copy page
Download PDF
Device status reporting to Kafka
In MQTT scenarios, device status reporting is a very common use case. After device information is reported to the MQTT server, the MQTT server needs to save all MQTT messages for subsequent analysis. This topic uses Kafka to implement device information reporting.​
Scenario description​
  1. The device reports shadow information to the MQTT topic corresponding to its device ID.​
  1. The MQTT server is configured with rules to forward multiple eligible MQTT topics to a single Kafka topic.​
Preparations​
  1. Install the MQTTX client, referring to the MQTTX official installation documentation.​
  1. Create a Cloud Native Message Engine MQTT instance with the specification mqtt.2k. For detailed operations, see Create MQTT Instance.​
  1. Create a Message Queue for Kafka instance, version 2.8.2. For detailed operations, see Create Instance.​
Operation steps​
  1. In the Message Queue for Kafka console, create the target topic.​
  • For detailed operations, see Create Topic, and create a topic named agg. In the instance details, obtain the VPC endpoint information for the SASL_PLAINTEXT access point, such as kafka-xxxxxxxxxxxxxxx.kafka.ivolces.com:9093.​
  1. In the Message Queue for Kafka console, create a Kafka user and configure the username, password, and permissions.​
  1. In the Cloud Native Message Engine MQTT Dashboard, create a Kafka producer connector.​
  1. In the host list, configure the PLAINTEXT endpoint address​
  1. Configure username and password​
  1. Select plain as the authentication method​
  1. In the Cloud Native Message Engine MQTT Dashboard, configure rule data input.​
  1. The MQTT server rule matches all topics under device/#​
  1. Forward to the agg topic in Kafka​
  1. In the Cloud Native Message Engine MQTT Dashboard, configure rule action output.​
  1. Select the registered Kafka connector​
  1. Enter the Kafka topic name of the target endpoint​
Result verification​
  1. Use the MQTTX client to simulate two devices and send data to the public endpoint of the MQTT instance.​
  1. id00125 sends a message to device/id00125​
  1. id00128 sends a message to device/id00128​
  1. Verify that the message has been matched in EMQX.​
  1. In the Message Queue for Kafka instance, verify that forwarded data is present in the agg topic.​
Last updated: 2026.01.26 16:22:55