Skip to main content
The Message Queuing Telemetry Transport (MQTT) protocol is ideal for connecting remote devices with a small code footprint and minimal network bandwidth. MQTT today is used in a wide variety of industries, such as automotive, manufacturing, telecommunications, oil and gas, etc.
MQTT source is currently in the technical preview stage.

Prerequisites

Before ingesting data from MQTT into RisingWave, please ensure the following:
  • The MQTT server is running and accessible from your RisingWave cluster.
  • If authentication is required for the MQTT broker, make sure you have the client username and password. The client user must have the subscribe permission for the topic.
  • Create the MQTT topic from which you want to ingest data.
  • Ensure that your RisingWave cluster is running.
For example, we create a topic named iot_data with the data from various IoT devices at a given timestamp, including temperature, humidity readings, and a status field indicating whether the device is in a normal or abnormal state. For more information to learn about MQTT and get started with it, refer to the MQTT guide.
Connecting to RabbitMQ with MQTTTo connect RisingWave to a RabbitMQ instance using the MQTT protocol, you need to enable and configure RabbitMQ’s MQTT plugin on the broker side:
  1. Enable the MQTT plugin:
  2. Set the MQTT v5 feature flag:
  3. Once configured, you can connect to RabbitMQ using the MQTT connector as described below.
For more details on RabbitMQ’s MQTT support, refer to the RabbitMQ MQTT documentation.

Ingest data into RisingWave

When creating a source, we have the option to either persist the data in RisingWave using CREATE TABLE or use CREATE SOURCE while specifying the connection settings and data format.

Syntax

Parameters

This SQL statement creates a table named iot_sensor_data with columns for device ID, timestamp, temperature, humidity, and device status. The table is configured to connect to an MQTT broker using the MQTT connector, with specific URL, topic, and quality of service (QoS) settings, the data is encoded as JSON.

Query the table

Let’s retrieve data from the created table:
Expected result:
After creating the table and querying it, you can now transform this IoT data in RisingWave from the MQTT server based on your requirements.