- Architecture Diagram
- Cloud Manager Service
- Transport Components
- Rule Engine Component
- Core Services
- ThingsBoard Edge Web UI
- External Systems
This article provides a high-level overview of ThingsBoard Edge architecture, including a diagram, a description of the data flow among the various components, and explanations of the key architectural choices.
ThingsBoard Edge components are initiated within a single Java Virtual Machine (JVM) and utilize shared OS resources. You can deploy and run the ThingsBoard Edge process with as little as 256 or 512 MB of RAM in a constrained environment.
ThingsBoard Edge is designed to be:
- Scalable: Distribute computations and data analysis across thousands of edges.
- Robust and efficient: A single edge can handle up to 1000 devices, depending on the use-case and the deployed hardware.
- Customizable: Easily add new functionality with customizable widgets and rule engine nodes.
- Durable: The edge collects all messages and events in the persistence layer. Specific messages can be transferred to the cloud, if necessary.
The diagram below depicts the key components of the edge and the interfaces they provide.
Cloud Manager Service
The ThingsBoard Edge communicates with the cloud (ThingsBoard CE) over the gRPC protocol, with the Cloud Manager managing this connection.
On one side, the Cloud Manager checks the cloud queue for new events and pushes them to the cloud as soon as they become available.
On the other side, it handles all events coming from the ThingsBoard CE server and processes them accordingly.
The Cloud Manager employs an autogenerated pair of Routing key and Secret to connect to the cloud instance.
For enhanced security, a gRPC connection can be established on top of SSL/TLS technology. For more details, please refer to the gRPC over SSL/TLS guide.
ThingsBoard Edge offers MQTT, HTTP, and CoAP-based APIs available for your device applications/firmware. Each protocol API is provided by a distinct component within ThingsBoard Edge’s “Transport Layer”.
ThingsBoard Edge supports standard ThingsBoard CE/PE device communication protocols:
- The HTTP Transport component provides device APIs as described here;
- The MQTT Transport component provides device APIs as explained here, and it also enables gateway APIs as detailed here;
- The CoAP Transport component provides device APIs as outlined here.
Each transport component pushes data to the rule engine, and some may also utilize core services to issue requests to the database for device credential validation and more.
Rule Engine Component
The ThingsBoard Edge rule engine is responsible for processing incoming messages according to user-defined logic and flow. The rule engine leverages an Actor System to create actors for primary entities, such as rule chains and rule nodes. The architecture of the ThingsBoard Edge engine mirrors that of the Server rule engine, though the configuration differs slightly - Edge utilizes rule chain templates in place of standard rule chains. For more detailed information on Edge rule chain templates, please refer to the documentation page.
ThingsBoard Edge Core handles REST API calls and WebSocket subscriptions. Additionally, it maintains up-to-date information about active device sessions and monitors device connectivity state. ThingsBoard Edge Core employs an Actor System to implement actors for key entities, including tenants and devices.
ThingsBoard Edge Web UI
ThingsBoard Edge includes a lightweight component, developed using the Express.js framework, to host static web UI content. These components are entirely stateless, with minimal configuration needed. The static web UI contains an application bundle; once loaded, the application begins using the REST API and WebSockets API provided by ThingsBoard Edge Core.
Messages from ThingsBoard Edge can be pushed to external systems via the Rule Engine. It’s possible to transmit data to an external system, process that data, and then relay the processing results back to ThingsBoard Edge for visualization. Please review the rule engine documentation and guides for further details.