Subscriptions
Overview
A Subscription is responsible for executing logic when new data is received from a specific subject using Emitter Construct. The logic is defined inside the subscription, and it is triggered from the subscribe construct by passing the emitted data as input. This ensures real-time synchronization and event-driven behaviour across different parts of the application.
Subscriptions, act as event handlers for the data emitted by subjects. Subscriptions can be defined at the interface, master layout, or component level to react to changes and trigger necessary updates.
Purpose
- To execute predefined logic when a subject emits new data.
- To process and utilize the received input dynamically.
- To enable modular and reusable logic handling inside the subscription.
Steps to Use Subscription
- Before creating a subscription, ensure you have created a service and subject.
- Ensure that data is being emitted using the respective subject.
- Use the subscribe construct where you want to receive the emitted data and apply necessary changes to the component.
- Create the subscription to use inside the subscribe construct and perform the required logic with the received data.
Subscriptions Creation Steps
- Right-click on the Subscriptions in the explorer.
- Select Add. • A success message is displayed when a Subscription is successfully added. The created subscription contains Input Params (input param 'data' will be added by default with selected 'Subject' Type) and Variables.
| Property | Description | Comments |
|---|---|---|
| Name* | The unique identifier assigned to the subscription. | Used to reference the subscription. |
| Service* | Select the folder that contains the subject that is emitting data. | |
| Subject* | Select the specific subject that is emitting the data. | Subjects are filtered based on the previously selected folder |
| Description | A brief explanation of the Subscription purpose. | Helps users understand the Subscription functionality. |
| Is Active | Indicates whether the subscription is currently active or inactive. | Helps to decide to whether to use it or not. |
Note: An asterisk (*) denotes a mandatory property for adding a subscription.
Add variables
Users can add the variables to a subscription as applicable. To add, follow the below steps:
- Right-click the Variables and select Add. A pop-up window displays.
- Configure the below properties as required and the click Save. The success message displays upon successfully adding a variable.
| Property | Description | Is Required |
|---|---|---|
| Name* | A unique identifier for the Name. | What It Supports? Starts with a letter (A-Z or a-z), Allows letters, digits, and underscores after the first character, Supports single-character variable names, Empty trailing characters after the first letter are allowed. What It Does Not Support? Contains unsupported special characters, Empty strings are still invalid |
| Is Array | Specify whether the variable is an array or not. | By default, it is set to No. |
| Type* | Select the data type of the parameter from the drop-down. | For Map Configuration When the Map type is selected, additional fields appear: Key Type Specifies the data type of the map's keys. Supports all primitive types. Value Type Defines the data type of the map's values. Supports both primitive and complex types. Map types are not allowed as value types. Is Array (for Value Type) Determines if the value type should be an array. The Is Array checkbox controls the array status of the value type only. Behaviour The Default Value field is NOT visible when the Map type is selected. |
| Default Value | Default value for the selected type. | Default Value Controls Boolean: Dropdown with True and False options. String: Textbox for string input. Integer, Double, long: Numeric textbox. DateTime: Two options: Fixed: Displays a calendar for date selection. Current: Uses the current date and time. |
Note: An asterisk (*) denotes that the property is mandatory for creating a variable.
Note: No custom input parameters can be created in the subscription.
Note: The default input parameter is data, which is of the same type as the selected subject type.