- Architecture diagram
- Cloud manager service
- Transport components
- Rule engine component
- Core services
- ThingsBoard Edge Web UI
- External systems
This article describes ThingsBoard Edge architecture and consist of high level diagram, description of data flow between various components and some architecture choices made.
ThingsBoard Edge components are launched in a single Java Virtual Machine (JVM) and share the same OS resources. You can launch and run ThingsBoard Edge process with 256 or 512 MB of RAM in a constrained environment.
ThingsBoard Edge designed to be:
- scalable: spread your computation and data analysis on thousands of edges.
- robust and efficient: single edge can handle up to 1000 of devices depending on the use-case and deployed hardware.
- customizable: adding new functionality is easy with customizable widgets and rule engine nodes.
- durable: edge collects all messages and events in the persistence layer. Particular messages could be transferred to the cloud, if required.
The diagram below shows key edge components and interfaces they provide. Let’s walk through them.
Cloud manager service
ThingsBoard Edge connects to cloud (ThingsBoard CE/PE) over gRPC protocol and Cloud Manager is responsible for this communication.
On one side Cloud Manager checks cloud queue for new cloud events and push them to cloud once they are available.
On the other side Cloud Manager handles all events that are coming from ThingsBoard CE/PE server and process them accordingly.
Cloud Manager uses autogenerated pair of Routing key and Secret to connect to cloud instance.
For additional security gRPC connection could be established on top of SSL/TLS technology. For more details please refer to gRPC over SSL/TLS guide.
ThingsBoard Edge provides MQTT, HTTP and CoAP based APIs that are available for your device applications/firmware. Each of the protocol APIs are provided by a separate component and is part of ThingsBoard Edge “Transport Layer”.
ThingsBoard Edge provides support for standard ThingsBoard CE/PE device communication protocols:
- HTTP Transport component provides device APIs described here;
- MQTT Transport component provides device APIs described here and also enables gateway APIs described here;
- CoAP Transport component provides device APIs described here.
Each of the transport components pushes data to the rule engine and also may use core services to issue requests to the database to validate device credentials, etc.
Rule engine component
ThingsBoard Edge rule engine is responsible for processing the incoming messages with user defined logic and flow. Rule Engine uses Actor System under the hood to implement actors for main entities: rule chains and rule nodes. You can learn more about the edge rule engine using corresponding documentation page.
ThingsBoard Edge Core is responsible for handling REST API calls and WebSocket subscriptions. It is also responsible for storing up to date information about active device sessions and monitoring device connectivity state. ThingsBoard Edge Core uses Actor System under the hood to implement actors for main entities: tenants and devices.
ThingsBoard Edge Web UI
ThingsBoard provides a lightweight component written using Express.js framework to host static web ui content. Those components are completely stateless and no much configuration available. The static web UI contains application bundle. Once it is loaded, the application starts using the REST API and WebSockets API provided by ThingsBoard Edge Core.
It is possible to push messages from ThingsBoard Edge to external systems via the Rule Engine. You can push data to external system, process data and report the results of the processing back to ThingsBoard Edge for visualization. Please review rule engine documentation and guides for more details.