How to Dev - Example of Trigger / Sync Pattern

 

If I would like to synchronize a device data A with another B by trigger event, I can do it in several manners.
The first case would be the simplest. A triggering message arrives from MQTT event or from some NGSI ORION, or from some MyKPI, from dashboard event button, or email or anything, it does not matter. I can use two functions to prepare the message for A device and B device as follow:

If the event for triggering is from another device/entity changed by some action performed posting a data on Orion Broker V2, you can subscribe with the event on the Orion broker by using a specific Node (do it once otherwise you risk receiving many events). Every time the device / entity receives a message you can take it and generated a new message for a different device and post it on Orion API V2.

If you need to verify if the new data has been changed, you can read the last value of recipient Device/entity to compare and decide to update or not: