Skip to main content

Data forwarding


1. Introduction

1.1 Functional description

  • The Data forwarding service allows access to EdgeHub's Parameter data and forwards it to a customer-specified API/MQTT address.
  • A Forwarding rule supports sending data to one API or MQTT address.
    • The Message Format to be sent can be defined.
    • Variables can be defined within the Message, and these variables are bound to the Object's parameters as the data source.
  • Forwarding Rules can be defined at any level of the group.
  • Forwarding Rules are isolated between groups.
  • Forwarding Rules can define their own call frequency (between 5 to 1440 minutes, in minutes as the unit).

1.2 User scenario

Scenario

When a customer needs to periodically upload point data stored in EdgeHub to their existing information system, which may include:

  • MES
  • ERP
  • Other data management platforms

And the customer's information system already provides the following external interfaces for data import:

  • API (OAuth2 / Basic Authentication / Bearer Token / User Defined Authorization string)
  • MQTT

They can use the EdgeHub Data forwarding service.

Use Cases

  • IoT Water Resources

    image-IOTWater.png

    Integration Scenario:

    • API (OAuth 2)
    • Use the IoT Water Resources API to upload point data to the platform and become the physical quantity value of the platform's configured sensor devices.

2 Manual

2.1 Authentication

Users need to first establish the authentication method. forwarding-auth-00-add-new.png Currently supported authentication methods are as follows:

2.1.1 OAuth2

Forwarding supports OAuth2 authentication, and the details of OAuth2 are defined as follows:

  • Grant Type: Currently only supports the Client Credentials mode, users need to fill in the following three pieces of information
    • Token URL: API URL to obtain subsequent access tokens
    • Client ID: Client ID for the client credential mode
    • Client secret: Client secret for the client credential mode
  • Authorization data: Currently only supports filling in Request Headers
    • After obtaining the token, it will be added to the header in the calling Forwarding API as follows: Authorization: Bearer

forwarding-auth-01-oauth2-new.png

2.1.2 Basic Authentication

Users enter User Name / Password, encrypted by Base64, and put it in the Authorization: Basic Header. forwarding-auth-02-basic-auth-new.png

2.1.3 Bearer

Bearer Token mode, currently supports two types

  • Refreshable token

    The user's API needs to first use a custom Token API to obtain the token and include it in the Authorization: Bearer Header. Subsequently, the token needs to be reacquired using this Token API. forwarding-auth-03-bearer-refresh-new.png

  • Fix token string

    The user already knows the Bearer Token String and does not need to update the token. The token string can be directly used and included in Authorization: Bearer Header. forwarding-auth-04-bearer-fix-new.png

2.1.4 User Defined

If the user knows what string needs to be filled in the Authorization header, they can directly use this mode. forwarding-auth-05-user-defined-new.png 2.1.5 MQTT

If the user wants to use MQTT to send data, they can configure MQTT connection and account information here. forwarding-auth-06-mqtt-new.png

2.2 Forwarding

Users click the "Add" button in the Forwarding Rule List to add a Forwarding Rule. forwarding-forwarding-01-add-new.png

#### 2.2.1 API

When adding an API Rule, the following dialog box will appear, with the following field descriptions:

  • Rule Name: Enter the name of this Rule.
  • Query Frequency (min): The triggering frequency of the Forwarding Rule, in minutes. The current restricted range is (5~1440 minutes).
  • Authentication: Choose from None / OAuth2 / Basic Authentication / Bearer / User Defined, etc., for the authentication type.
  • API URL:
    • Method: Supports POST / PUT / PATCH.
    • URL: Enter the API URL to which this Rule should be delivered. Variables can be used, and variables are defined by enclosing them in symbols within the URL string. URL Parameters will be automatically generated for binding, allowing the user to define which EdgeHub Object Parameter needs to be bound to this variable.
  • API Body: Enter the API Body that needs to be delivered by this Rule. Currently, only JSON format is supported. Variables can be used, and variables are defined by enclosing them in symbols within the Body string. Body Parameters will be automatically generated for binding, allowing the user to define which EdgeHub Object Parameter needs to be bound to this variable.

forwarding-forwarding-02-api-new.png

  • Parameters Data source setting

    The data source for variables currently supports two settings:

    • Parameter: Specifies the EdgeHub Object Parameter Value as the value to be sent. Click the '+' symbol on the right to set the Parameter binding. forwarding-forwarding-03-parameter-assign-new.png

    • Time: Specifies the timestamp as the value to be sent. Click the '+' symbol on the right to set multiple time formats, and specify Time = the data time of a certain Parameter, or Time = the system sending time.

#### 2.2.2 MQTT

When adding an MQTT Rule, the following dialog box will appear, with the following field descriptions:

  • Rule Name: Enter the name of this Rule.
  • Query Frequency (min): The triggering frequency of the Forwarding Rule, in minutes. The current restricted range is (5~1440 minutes).
  • Authentication: Choose from None or MQTT type for the authentication type.
  • Topic: Enter the MQTT Topic to which this Rule should be delivered. Variables can be used, and variables are defined by enclosing them in symbols within the Topic string. Topic Parameters will be automatically generated for binding, allowing the user to define which EdgeHub Object Parameter needs to be bound to this variable.
  • Payload: Enter the MQTT Payload that needs to be delivered by this Rule. Currently, only JSON format is supported. Variables can be used, and variables are defined by enclosing them in symbols within the Payload string. Payload Parameters will be automatically generated for binding, allowing the user to define which EdgeHub Object Parameter needs to be bound to this variable.

forwarding-forwarding-04-mqtt-rule-new.png

  • Parameters Data source setting is the same as described in section 2.2.1.

#EdgeHub