The current architecture of service layers is organized as follows:
Controller
TbService
Service
Dao
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:
For the edge, a new listener has been introduced: EdgeEventSourcingListener.java.
The entire notification logic has been relocated from the Controller and Tb*Service* layers to the Service** layer.
The EdgeSynchronizationManager has been added to ensure synchronization between cloud and edge events, preventing event loops.
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