Subscribe/notify (Notifications)

Introduction

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

 

 

Figure 1. Notifications on the Trusted Twin platform.

Concept

Overview

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.

 

 

Figure 2. Notification message.

Notifications can be triggered by:

  • creation of a Ledger Entry with a given name,
  • changes to the value of a Ledger Entry,
  • deletion of a Ledger Entry with a given name,
  • creation of a Sticker with a given name,
  • removal of a Sticker with a given name,
  • expiration of a Sticker with a given name.

Subscribe/notify flow

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

 

 

Figure 3. Creating and confirming a subscription.

Refreshing a subscription

 

 

Figure 4. Refreshing a subscription.

Removing a subscription

 

 

Figure 5. Removing a subscription.

Entry-related events

A Notification can be triggered by the following events:

 

  • creation of a Ledger Entry with a given name,
  • changes to the value of a Ledger Entry,
  • deletion of a Ledger Entry with a given name.

Events triggering notifications are defined in a form of rules.
Read more: Rules

Developer resources
Rules

Rules are defined at the Ledger Entry level in the “publish” attribute.

 

 

Figure 6. Notification rule in the "publish" attribute of a Ledger Entry.

A notification message is published to the given topic each time the given Rule resolves to True after Ledger entry modification.

Sticker-related events

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.

Figure 7. Notification events defined in the "publish" attribute of a Sticker.

Users can select any set of events individually for each Sticker. The notification is published to a given topic.

Developer resources
Templates

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). 

For more information about how to use the Trusted Twin platform in your application’s architecture or technology stack, please contact hello@trustedtwin.com or schedule a video consultation with us through Calendly.

ON THIS PAGE