Skip to content

dut-xiayuan/enos-subscription-service-sdk-dotnet

 
 

Repository files navigation

Using EnOS Data Subscription SDK for .NET

Table of Contents

EnOS Data Subscription Service improves the API calling efficiency of applications with active data push, which supports subscription to real-time asset data, offline asset data, and asset alert data.

After configuring and starting data subscription jobs on the EnOS Management Console, you can use the Data Subscription SDK for .NET to develop applications for consuming the subscribed data.

Installation

Prerequisites

The Data Subscription SDK is for .NET Framework 4.7, and newer versions.

You can install the SDK from Package Manager Console, or build from source.

Installing from Package Manager Console

The latest version of EnOS Data Subscription SDK for .NET is available in the Package Manager Console and can be installed using:

Install-Package enos_subscription -Version 2.4.2

Building From Source

  1. Obtain the source code of Data Subscription SDK for .NET.

    • From GitHub:
    git clone https://github.com/EnvisionIot/enos-subscription-service-sdk-dotnet.git
    
    • From EnOS SDK Center. Click SDK Center from the left navigation of EnOS Console, and obtain the SDK source code by clicking the GitHub icon in the Obtain column.
  2. In Visual Studio, add the source code project into your solution and add as reference to your project.

The EnOS Data Subscription SDK for .NET has the following dependency modules:

Feature List

EnOS Enterprise Data Platform supports subscribing to asset time series data and alert data and pushing the subscribed data to applications, thus improving the data query efficiency of applications.

The features supported by this SDK include:

  • Consuming subscribed real-time asset data
  • Consuming subscribed alert data
  • Consuming subscribed offline asset data

Sample Codes

Code Sample for Consuming Subscribed Real-time Data

using enos_subscription.client;

using (DataClient client = new DataClient("sub-host", "sub-port", "Your Access Key of this subscription", "Your Access Secret of this subscription")) {    
    
    client.subscribe("Your subscription Id", "Your consumer group");

    foreach (var message in client.GetMessages())
    {
       //do something with the message
    }
}

Code Sample for Consuming Subscribed Alert Data

using enos_subscription.client;

using (AlertClient client = new AlertClient("sub-host", "sub-port", "Your Access Key of this subscription", "Your Access Secret of this subscription")) {    
    
    client.subscribe("Your subscription Id", "Your consumer group");

    foreach (var message in client.GetMessages())
    {
       //do something with the message
    }
}

Code Sample for Consuming Subscribed Offline Data

using enos_subscription.client;

using (OfflineClient client = new OfflineClient("sub-host", "sub-port", "Your Access Key of this subscription", "Your Access Secret of this subscription")) {    
    
    client.subscribe("Your subscription Id", "Your consumer group");

    foreach (var message in client.GetMessages())
    {
       //do something with the message
    }
}

Related Information

To learn more about the Data Subscription feature of EnOS Enterprise Data Platform, see Data Subscription Overview.

Release Notes

  • 2020/04/24 (2.4.1): Initial release

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%