EMQ X Rule Engine (Hereinafter referred to as rule engine) is used to configure the processing and response rules of EMQ X message flows and device events.
Rule engine not only provides a clear and flexible "configurable" business integration solution, which is used to simplify the business development process, improve usability, and reduce the coupling degree between the business system and EMQ X, but also provides a better infrastructure for the private function customization of EMQ X to speed up development delivery.
VPC Peering Connection
The processing results of the rule engine can flow to your external resources, such as Kafka and relational database. You need to create a VPC peering connection for the deployment to access the specified resources.
You can create a resource on the Resources page to establish the connection between EMQ X and your resources.
To facilitate the creation and maintenance of rules, EMQ X manages the resources associated with the rules engine actions independently.
The resource saves the resource instance (such as database connection, Web Server connection address, the request method, and authentication mode) required by the rule engine action. Before creating the rule, you need to create the resources required by the related action and ensure that the resource is available.
In the rule engine processing flow, the data is filtered by the rules at first and is processed by the action in the end.
The rules output data through actions and finally implement business functions such as data persistence, device state switching, and event notification.
Actions define operations on data. Most actions require binding resources and configuring the format in which data is written and passed, and additional parameters (such as executed SQL statement templates, topic information for message republish).
The rules engine has a variety of built-in actions:
Data bridge to Kafka;
Data bridge to MQTT Broker;
Data bridge to EMQ X Broker;
Data to InfluxDB: Save data to InfluxDB;
Republish: The message is republished to the specified topic for message aggregation, redirection, and so on;
Data to Web Server: Send data to the API gateway related to the HTTP protocol, support common public cloud function calculation, private deployment server, WehHook, etc., and the data processing is flexible.
The rule engine in the EMQ X MQTT Cloud can be used free of charge. For detailed instructions on the SQL syntax and use of the rule engine, see Rules Engine using guide.