Skip to main content

Subscribing Basics

What is subscribing?

Subscribing in OpenDataDSL refers to one of the following:

  • Event-driven data flows

    Take an automatic action based on information changes

  • Real-time data changes

    React to data changes in real-time

What can you subscribe to?

There are minor differences between the 2 different method of subscription which are explained here:

Event-driven subscriptions

With event-driven subscriptions, as well as the entity type and id, you can specify the action taken from the following:

  • Create
  • Update
  • Delete
  • Tag
  • All

Real-time subscriptions

For real-time subscriptions, you subscribe to the id of the entities you want to listen for, and the action that is taken using a method in the format:

  • On{entity}Create - e.g. OnObjectCreate
  • On{entity}Update - e.g. OnObjectUpdate
  • On{entity}Delete - e.g. OnObjectDelete

With real-time subscriptions, you can also listen for process and process execution messages using:

  • OnExecutionMessage
  • OnProcessMessage

Entities

The following table shows the entities that can be subscribed to by each method:

EntityEvent-DrivenReal-Time
Data Updates
Object (Master Data)yesyes
Data - timeseriesyesyes
Data - curveyesyes
Data - matrixyesyes
Eventyesyes
Reportyes-
Calendaryesyes
Expiry Calendaryesyes
Action-yes
Workflow-yes
Server Events
Process Execution Message-yes
Process Run-yes

Event-driven data flows

Event-driven data flows refer to a design pattern or architecture where data processing and communication happen in response to events or changes in the system. In this pattern, events trigger the flow of data through a system, where each event is processed independently, and a corresponding action is taken based on the event.

What does a subscription look like?

A subscription has the following properties:

NameDescriptionType
_idUnique IdObjectId
nameName of the subscriptionString
descriptionDescription of the subscriptionString
enabledFlag to enable/disable this subscriptionBoolean
systemFlag to say whether this subscription is system managed and cannot be changedBoolean
environmentThe name of the environment to run in (default production)String
objectsAn array of items to subscribe toArray of subscription items
targetsAn array of target actions to callArray of subscription targets

Subscription Item details

NameDescriptionType
_idUnique IdObjectId or String
keyA name that this item is referred to asString
serviceThe name of the service this item belongs toString
idThe id of the item to subscribe toString
actionThe action to subscribe to (create/update/delete/tag/all)String

Subscription Target details

NameDescriptionType
nameThe target name, e.g. EmailTargetString

The rest of the properties for the subscription target are specific to the type of target

What actions can be taken?

In OpenDataDSL, as of today, you can perform one of the following event-driven actions (known as targets):

Real-time data changes

The underlying infrastructure for OpenDataDSL real-time is SignalR.

SignalR is an open-source real-time communication framework developed by Microsoft. It simplifies the process of adding real-time web functionality to applications by enabling bi-directional communication between the server and client.

SignalR supports multiple client platforms, including web browsers (JavaScript), .NET, Xamarin, and other platforms through the use of client libraries. It provides a unified API for working with these different client platforms.

Key features of SignalR include:

  • Real-time updates

    SignalR enables real-time communication, allowing the server to push updates to connected clients instantly.

  • Scalability

    SignalR can scale to handle a large number of concurrent connections by using techniques like message queuing and distributed caching.

  • Cross-platform support

    SignalR provides client libraries for various platforms, allowing developers to build real-time applications across different devices and technologies.

  • Automatic reconnection

    SignalR handles automatic reconnection for clients in case of network interruptions or server restarts, ensuring a seamless user experience.

  • Security

    SignalR includes features for authentication and authorization, allowing developers to secure their real-time applications.