This article describes the subscribe/notify (Notifications) concept on the Trusted Twin platform.
The purpose of this article is to provide system architects and developers with conceptual knowledge required to design solutions on the Trusted Twin platform. In order to consult developer resources, please navigate to the Trusted Twin docs website.
5 min read.
The Trusted Twin platform allows to automatically publish notifications to user-defined topics when such user-defined events occur. Users can subscribe their webhooks to such topics. The webhooks will be automatically invoked each time a new notification is published to the subscribed topic.
Notifications can be triggered by:
- changes to the value of a Ledger Entry,
- creation of a Ledger Entry with a given name,
- creation of a Sticker with a given name,
- removal or expiration of a Sticker with a given name,
The illustrations below shows how the subscribe/notify mechanism works on the Trusted Twin platform. The example shows how notifications work when triggered by changes to values of Ledger Entries.
Creating and confirming a subscription
Refreshing a subscription
Removing a subscription
Events triggering notifications are defined in a form of rules.
Read more: Rules
Rules are defined at the Ledger Entry level in the
A notification message is published to the given topics each time the given Rules resolves to
True after Ledger entry modification.
Events triggering notifications are defined during the Sticker creation process. They are defined for a given Sticker. Multiple events can be set individually for each Sticker.
A Notification can be triggered by the following events:
- Sticker creation,
- Sticker removal,
- Sticker expiration.
Users can select any set of events individually for each Sticker. The notification is always published to a topic name equal to the Sticker color.
Tips & tricks
- Ledger Entry change notifications can be used for calculating and setting the object status when a sample is ready (e.g., leak detection, anomaly detection).
- Sticker notifications can be used to model timeouts or periodic actions for objects (e.g., checking an object’s health every month).