Save Pipeline

Save the configuration of a specific stream processing pipeline.

Prerequisites

A stream processing pipeline is created with the Stream Processing service, and the pipeline ID is available.

Request Format

POST https://{apigw-address}/streaming/v2.0/streaming/pipeline/{pipelineId}?action=save

Request Parameters (URI)

Name Location (Path/Query) Mandatory/Optional Data Type Description
pipelineId Path Mandatory String The stream processing pipeline ID, which can be found on the EnOS Management Console > Stream Processing > Stream Operation page. When null is specified, use this API to create a stream processing pipeline.
orgId Query Mandatory String The organization ID. How to get the orgId>>

Request Parameters (Body)

Name Mandatory/Optional Data Type Description
version Optional String Template version that is used by the stream processing pipeline.
name Optional String Stream processing pipeline name.
templateType Optional Integer Type of the template that is used by the stream processing pipeline. Possible values are 1: Origin Template; 0: Time Window Aggregation Template; 2: Multi-Merging Template; 3: Electric Energy Cal (by Metering Reading) Template; 4: Electric Energy Cal (by Average Power) Template; 5: Electric Energy Cal (by Instant Power) Template.
templateName Optional String Template that is used by the stream processing pipeline.
messageChannel Optional Integer Message channel that is used by the stream processing pipeline (0: real-time channel; 1: offline channel).
pipelineJson Optional JSONObject Configuration of the stream processing pipeline in JSON format.

Response Parameters

Name Data Type Description
data String Returns the pipeline ID upon success.

Error Code

Code Error Information Description
61100 The Stream configuration JSON is invalid. The pipeline configuration JSON is not valid. Please check the syntax.
61108 stream processing pipeline does not exit. Stream processing pipeline does not exist. Please check the pipeline ID.
61112 Failed to save the stream configuration. Failed to save the stream processing pipeline configuration.

Sample

Request Sample

url: https://{apigw-address}/streaming/v2.0/streaming/pipeline/{pipelineId}?action=save

method: POST

requestBody:
{
        "templateType": 3,
        "pipelineName": "stream_power_calculation",
        "templateName": "Electric Energy Cal by Instant Power",
        "version": "0.1.0",
        "messageChannel": 0,
        "desc": "",
        "pipelineJson": {
            "piDetail": true,
            "points": [{
                "minValue": "0",
                "outputPointId": "SPIC_Solar_Inverter::INV.AccumulatingPower_day",
                "exceptionPolicy": "1",
                "maxValue": "",
                "minValueInclude": true,
                "piDetailWindowSize": "FIVE_MINUTE",
                "maxValueInclude": false,
                "inputPointId": "SPIC_Solar_Inverter::INV.GenActivePW",
                "detailOutputPointId": "SPIC_Solar_Inverter::INV.AccumulatingPower_5min"
            }]
        }
}

Return Sample

{
  "code": 0,
  "msg": "OK",
  "data": "d790d27f-e977-403c-b4c8-e111443c563f"
}

SDK Samples


You can access the SDK samples for stream processing service on GitHub: