Mqtt Broker Rule
DodaTech
1 min read
In this tutorial, you'll learn about EMQX Rule Engine Not Triggering. We cover key concepts, practical examples, and best practices.
The Problem
SQL-like rules configured in EMQX rule engine do not process messages.
Quick Fix
Wrong
SELECT * FROM '#' # Rule matches nothing
Rule never triggers — no data processed.
Right
# 1. Create a rule that processes sensor data
curl -u admin:public -X POST http://localhost:18083/api/v5/rules \
-H 'Content-Type: application/json' \
-d '{
'name': 'sensor_rule',
'sql': 'SELECT payload.temperature, payload.humidity FROM \'sensors/+/data\'',
'actions': ['inspect']
}'
# 2. Publish test message
mqttx pub -t sensors/room1/data -m '{'temperature':25.5,'humidity':60}'
# 3. Check rule metrics
curl -u admin:public http://localhost:18083/api/v5/rules/sensor_rule
Rule metrics show messages matched and processed.
Prevention
Rule SQL syntax: SELECT ... FROM "topic" [WHERE condition]. Topic filters must match PUBLISH topics exactly. Payload accessing depends on content type: JSON (payload.field), binary (payload), Schema Registry. Use the inspect action for debugging. Check rule metrics for matched/ failed counts.
DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.
FAQ
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro