Rule Engine Architecture

Architecture Overview

As mentioned in the Rule Engine Getting Started, the Rule Engine is a tool that allows you to create automated actions based on specific conditions or events generated by IoT devices.

The Rule Engine is built on three parts: trigger, rule, and action.

Architecture overview

Trigger

A trigger is an event or condition that initiates rule execution. In other words, a trigger listens for events of a particular type and, once it occurs (e.g., the device posts data), it executes the attached rule(s).

See triggers to learn more about triggers and their types.

Rule

A JavaScript expression that is executed for the endpoint. Usually, a rule returns a value, and based on this returned value, the Rule Engine decides which actions to execute next — Positive, Negative, or no actions at all.

Action

An action is an operation performed after a rule is executed and returns a value. Like a trigger, an action is attached to a rule. There are two types of actions: Positive and Negative. Positive actions are executed if the rule returns true or any other value except false, null, or undefined. Negative actions are executed if the rule returns false. No actions are executed if the rule returns null or undefined.

Let’s put this into an example:

  • Trigger: The device reports a temperature.
  • Rule: The temperature value is greater than 30°C.
  • Positive Action: Send an email.

Next Steps