Official | HULFT IoT EdgeStreaming First Step Guide Third Edition: November 1, 2020

Creation of stream processing to get script variable values and send the values to an external system at regular intervals

In previous procedures, we have created stream processing to obtain temperatures from the holding registers of Modbus TCP-compatible devices and save them to script variables.

In this section, create stream processing to get values from script variables and send them to an external system with REST API at regular intervals.

 

  1. Drag and drop Basic > Basic > Periodic event from the tool palette onto the script canvas.

  2. The New Periodic event operation property settings dialog box appears. Specify the interval at which data is sent to the external system.

    Name

    Enter any value (single byte alphanumeric characters, underscores).

    Interval

    Enter the interval at which to send values to the external system (unit: seconds).

    In this example, enter "60".

     

    When you click Finish, the property settings dialog box closes and the Periodic Event processing icon is placed on the script canvas.

     

  3. Drag and drop Generic protocol > HTTP > Send from the tool palette onto the script canvas.

     

  4. The New Send operation property settings dialog box appears. Configure the settings of REST API for the external system.

    Name

    Enter any value (single byte alphanumeric characters, underscores).

    Input data

    Select the icon name of the Periodic Event processing that you placed earlier.

    URL

    Set the URI for REST API.

    Method

    Set the HTTP method (POST or PUT) for REST API.

    Header

    Set the request header that is necessary to send a request to REST API.

     

  5. When you click Finish, the property settings dialog box closes and the Send processing icon is placed on the script canvas.

    The Periodic Event processing icon and the Send processing icon are connected by a "stream flow" (an orange broken line).

     

  6. Right-click the stream flow that connects Periodic Event processing to Send processing, and select Add mapping from the menu.

    Mapper is placed in between Periodic Event processing and Send processing.

     

  7. Double-click the "mapping_2" icon placed earlier to open the Mapper editor.

     

  8. In Output destination, set the input schema of the Send processing.

    = Remarks =

    For the setting method, refer to step 3 and after in Addition and configuration of Mapper.

    In this scenario, set the schema as follows:

     

  9. Create a mapping link.

    Click the script variable "temperature" in the input source, and move the mouse cursor to drag and drop it onto the element "temperature" in the output destination.

    When you release the mouse button over the element "temperature," the script variable "temperature" and the element "temperature" are connected by a mapping link as shown below.

 

 

Official | HULFT IoT EdgeStreaming First Step Guide Third Edition: November 1, 2020