thingsboard / thingsboard-edge

Apache License 2.0
93 stars 71 forks source link

Edge - Introduce Event Pub/Sub Model for Detecting Changes in Entities #67

Closed AndriiLandiak closed 11 months ago

AndriiLandiak commented 11 months ago

Pull Request description

Feature co-author: @volodymyr-babak Thingsboard PR: 9052

Motivation:

The current architecture of service layers is organized as follows:

At present, all notifications pushed to the edge originate from the TbService layer. This works effectively when manipulations are made through the Controller, ensuring that edge entities receive notifications successfully. However, issues arise when actions are carried out via rule chains or other system components. These components might directly use the Service layer, bypassing TbService.

The primary aim of this pull request is to relocate the notification process from the TbService layer to the Service layer.

Implementation:

To achieve this objective, we utilized Spring Listeners/Publishers. The implementation is designed to be generic. For any future components (other than edge) that might need to listen to these events, integration is straightforward. This can be done by adding new listeners and defining the specific logic for handling the events.

Implementation details:

General checklist

Back-End feature checklist