Developing Data Subscription Jobs¶
The EnOS Data Asset Management provides the Data Subscription Service to improve the performance of API calls with the active push of subscribed data, which supports the subscription of asset time series data, asset alert data, device event data, device event report data, and results data. With this service, applications do not need to call APIs repeatedly and frequently to get asset data. Instead, applications can call APIs only when there is pushed data, thus improving API call performance and reducing costs.
Data Subscription Workflow¶
This article describes the steps to develop data subscription jobs in EnOS Cloud and EnOS Edge. The general use path is as follows:
![_images/data_subscription_process.png](_images/data_subscription_process.png)
Note
EnOS Cloud supports the data subscription service for multiple OUs, each of which can create data subscription jobs with a maximum of 15. EnOS Edge supports the data subscription service for one OU, in which each application can create data subscription jobs with a maximum of 5.
Creating a Subscription Job (EnOS Cloud)¶
Procedure¶
Log in to the EnOS Management Console and select the Data Subscription module. On the Data Subscription page, click the New Subscription button to open the subscription configuration page.
Select the data subscription type, which determines the data source to be subscribed to. For more information about the data source, see EnOS Cloud Configuration List.
In the ID field, enter an ID for the subscription job or click Generate to use the system-generated ID. The subscription ID is a mandatory parameter for consuming subscribed data.
From the SA drop down list, select the SA (service account) that is used for client and data authentication. Each subscription topic must have an associated SA. When an SA is deleted, the data subscription configuration will be automatically disabled.
Note
The SA account associated with the data subscription job must be authorized to access the asset data. For more information about authorizing the SA account, see Managing Service Accounts.
Select a Message Channel for the subscribed data.
In the Description field, enter a short description of the data subscription job.
For the Clients section, choose the clients whose data you want to subscribe to based on the data access permission of the selected SA (associated with purchased applications).
Note
When a client revokes the data access authorization of an SA, the related subscription to the client’s data will be stopped automatically.
For different data subscriptions, complete the related data filtering configurations. When a subscribed data source (model or measurement point) is deleted, the system will keep the data subscription configuration, but an error message will be displayed, reporting that the configured data source is an unknown object.
EnOS Cloud Configuration List¶
Data source | Description | Message channel | Data filtering configuration |
---|---|---|---|
Time Series Data | Ingested from assets or generated after calculation (including real-time and offline data) |
|
|
Alert Data | Generated according to specific alert rules defined for real-time data |
|
|
Device Management Event | Events that happened within the EnOS IoT Hub service, such as device registration, deletion, topology relationship changes, OTA firmware upgrade, etc | None | Event types: specific types of events |
Device Event Report | Event information reported by the device model in the EnOS IoT hub, including Info, Warn, and Error | None |
|
Creating a Subscription Job (EnOS Edge)¶
Procedure¶
Log in to the EnOS Management Console and select the Edge Management module. Then go to Edge Details > Data Subscription, and click the New Subscription button to open the subscription configuration page.
Select the data subscription type, which determines the data source to be subscribed to. For more information about the data source, see EnOS Edge Configuration List.
In the ID field, enter an ID for the subscription job or click Generate to use the system-generated ID. The subscription ID is a mandatory parameter for consuming subscribed data. The ID naming rules are as follows:
- Time series data subscription ID must start with DATASVC.SUB.
- Results subscription (device async control) ID must start with DATASVC.CONTROL.
- Results subscription (device async set point) ID must start with DATASVC.SET.
From the SA drop down list, select the SA (service account) that is used for client and data authentication. Each subscription topic must have an associated SA. When an SA is deleted, the data subscription configuration will be automatically disabled. Here SA is the account of the registered application on EnOS Edge.
Note
The SA account associated with the data subscription job must be authorized to access the asset data. For more information about authorizing the SA account, see Managing Service Accounts.
Select a Message Channel for the subscribed data.
In the Description field, enter a short description of the data subscription job.
For different data subscriptions, complete the related data filtering configurations. When a subscribed data source (model or measurement point) is deleted, the system will keep the data subscription configuration, but an error message will be displayed, reporting that the configured data source is an unknown object.
EnOS Edge Configuration List¶
Data source | Description | Message channel | Data filtering configuration |
---|---|---|---|
Time Series Data | Ingested from assets or generated after calculation (including real-time and offline data) | Real-Time |
|
Alert Data | Generated according to specific alert rules defined for real-time data | Basic alerts |
|
Results Data | The results of the control commands |
|
None |
Edge Device Event | Events that occur inside EnOS Edge devices. | None | Event type: only supports Edge publishing events |
Enabling the Subscription Job¶
After the subscription job is configured, find the saved topic on the Data Subscription page, and click the Enable icon to run the subscription job. The data producer will start writing data on the topic.
Managing the Subscription Job¶
Editing the Subscription Job¶
You can edit a subscription job by clicking the edit button on the Data Subscription page. And save your configuration after editing.
Deleting the Subscription Job¶
You can choose to delete a subscription job on the Data Subscription page. Note that jobs in running status cannot be deleted and the deleted jobs cannot be restored.
Viewing the Subscription Job (EnOS Edge only)¶
Go to Edge Details > Application, and click View Subscription to view the subscription jobs of the application. configuration page.
Batch Operations (EnOS Edge only)¶
On the Edge Details > Data Subscription page, click the Batch Operation drop down list. Then you can choose to import, export, and delete subscription jobs in batches.
Note
Ensure that the amount of subscription jobs under one application is no more than 5. Otherwise, an error will be displayed.