EMQX, a robust open-source MQTT message broker, is engineered for scalable, distributed environments, prioritizing high
availability, throughput, and minimal latency. As a preferred protocol in the IoT landscape, MQTT (Message Queuing
Telemetry Transport) excels in enabling devices to effectively publish and subscribe to messages.Offered by EMQ, EMQX Cloud is a comprehensively managed MQTT service in the cloud, inherently scalable and secure. Its
design is particularly advantageous for IoT applications, providing dependable MQTT messaging services.This tutorial guides you on streaming MQTT data to Upstash via data integration. It allows clients to send temperature
and humidity data to EMQX Cloud using MQTT and channel it into Upstash for Redis storage.
In the EMQX Cloud console, choose Data Integrations and select Upstash for Redis.
Input Endpoints info from the Redis detail page into the Redis Server field, including the port. Enter the
password in Password and click Test to ensure connectivity.
Click New to add a Redis resource. A new Upstash for Redis will appear under Configured Resources.
Formulate a new SQL rule in the SQL field. This rule will read from temp_hum/emqx and append client_id, topic,
timestamp.
up_timestamp: Message report time
client_id: Publishing client’s ID
temp: Temperature data
Hum: Humidity data
Copy
Ask AI
SELECTtimestamp as up_timestamp,clientid as client_id,payload.temp as temp,payload.hum as humFROM"temp_hum/emqx"
Execute an SQL test with payload, topic, client info. Successful results confirm the rule’s effectiveness.
Proceed to Next to link an action. The rule will store the timestamp, client ID, temperature, and humidity in
Redis. Click Confirm.
Copy
Ask AI
HMSET ${client_id} ${up_timestamp} ${temp}
Post-binding, click View Details for the rule SQL and bound actions.
To review rules, select View Created Rules in Data Integrations. Check detailed metrics in the Monitor
column.