Forráskód Böngészése

feat:add internal support sink plugins

RockyJin 4 éve
szülő
commit
0388bc2d6f

+ 1 - 1
docs/en_US/rules/sinks/edgex.md

@@ -4,7 +4,7 @@ The action is used for publish output message into EdgeX message bus.
 
 
 | Property name | Optional | Description                                                  |
 | Property name | Optional | Description                                                  |
 | ------------- | -------- | ------------------------------------------------------------ |
 | ------------- | -------- | ------------------------------------------------------------ |
-| protocol      | true     | If it's not specified, then use default value ``tcp``.       |
+| protocol      | true     | The protocol. If it's not specified, then use default value ``tcp``. |
 | host          | true     | The host of message bus. If not specified, then use default value ``*``. |
 | host          | true     | The host of message bus. If not specified, then use default value ``*``. |
 | port          | true     | The port of message bus. If not specified, then use default value ``5563``. |
 | port          | true     | The port of message bus. If not specified, then use default value ``5563``. |
 | topic         | true     | The topic to be published. If not specified, then use default value ``events``. |
 | topic         | true     | The topic to be published. If not specified, then use default value ``events``. |

+ 1 - 1
docs/en_US/rules/sinks/logs.md

@@ -1,6 +1,6 @@
 # Log action
 # Log action
 
 
-The action is used for print output message into log file, the log file is at  `` $kuiper_install/log/stream.log`` by default.
+The action is used for print output message into log file, the log file is at `$kuiper_install/log/stream.log` by default.
 
 
 No properties can be specified for the action.
 No properties can be specified for the action.
 
 

+ 11 - 11
docs/en_US/rules/sinks/mqtt.md

@@ -1,20 +1,20 @@
 # MQTT action
 # MQTT action
 
 
-The action is used for publish output message into a MQTT server. 
+The action is used for publish output message into an MQTT server. 
 
 
 | Property name      | Optional | Description                                                  |
 | Property name      | Optional | Description                                                  |
 | ------------------ | -------- | ------------------------------------------------------------ |
 | ------------------ | -------- | ------------------------------------------------------------ |
-| server             | false    | The broker address of the mqtt server, such as ``tcp://127.0.0.1:1883`` |
-| topic              | false    | The mqtt topic, such as ``analysis/result``                  |
-| clientId           | true     | The client id for mqtt connection. If not specified, an uuid will be used |
-| protocolVersion    | true     | 3.1 (also refer as MQTT 3) or 3.1.1 (also refer as MQTT 4).  If not specified, the default value is 3.1. |
-| qos                | true     | The QoS for message delivery. Only int type value 0 or 1 or 2.                                |
-| username           | true     | The user name for the connection.                            |
+| server             | false    | The broker address of the MQTT server, such as `tcp://127.0.0.1:1883` |
+| topic              | false    | The MQTT topic, such as `analysis/result`                    |
+| clientId           | true     | The client id for MQTT connection. If not specified, an uuid will be used |
+| protocolVersion    | true     | MQTT protocol version. 3.1 (also refer as MQTT 3) or 3.1.1 (also refer as MQTT 4).  If not specified, the default value is 3.1. |
+| qos                | true     | The QoS for message delivery. Only int type value 0 or 1 or 2. |
+| username           | true     | The username for the connection.                             |
 | password           | true     | The password for the connection.                             |
 | password           | true     | The password for the connection.                             |
-| certificationPath  | true     | The certification path. It can be an absolute path, or a relative path. If it is an relative path, then the base path is where you excuting the ``server`` command. For example, if you run ``bin/server`` from ``/var/kuiper``, then the base path is ``/var/kuiper``; If you run ``./server`` from ``/var/kuiper/bin``, then the base path is ``/var/kuiper/bin``. |
-| privateKeyPath     | true     | The private key path. It can be either absolute path, or relative path. For more detailed information, please refer to ``certificationPath``. |
-| insecureSkipVerify | true     | If InsecureSkipVerify is ``true``, TLS accepts any certificate presented by the server and any host name in that certificate.  In this mode, TLS is susceptible to man-in-the-middle attacks. The default value is ``false``. The configuration item can only be used with TLS connections. |
-| retained           | true     | If retained is ``true``,The broker stores the last retained message and the corresponding QoS for that topic.The default value is ``false``.
+| certificationPath  | true     | The certification path. It can be an absolute path, or a relative path. If it is an relative path, then the base path is where you excuting the `server` command. For example, if you run `bin/server` from `/var/kuiper`, then the base path is `/var/kuiper`; If you run `./server` from `/var/kuiper/bin`, then the base path is `/var/kuiper/bin`. |
+| privateKeyPath     | true     | The private key path. It can be either absolute path, or relative path, which is similar to use of certificationPath. |
+| insecureSkipVerify | true     | If InsecureSkipVerify is `true`, TLS accepts any certificate presented by the server and any host name in that certificate.  In this mode, TLS is susceptible to man-in-the-middle attacks. The default value is `false`. The configuration item can only be used with TLS connections. |
+| retained           | true     | If retained is `true`,The broker stores the last retained message and the corresponding QoS for that topic.The default value is `false`.
 
 
 Below is sample configuration for connecting to Azure IoT Hub by using SAS authentication.
 Below is sample configuration for connecting to Azure IoT Hub by using SAS authentication.
 ```json
 ```json

+ 2 - 2
docs/en_US/rules/sinks/nop.md

@@ -1,9 +1,9 @@
 # Nop action
 # Nop action
 
 
-The action is an Nop sink, the result sent to this sink will be ignored. If specify the ``log`` property to ``true``, then the result will be saved into log file, the log file is at  `` $kuiper_install/log/stream.log`` by default.
+The action is an Nop sink, the result sent to this sink will be ignored. If specify the `log` property to `true`, then the result will be saved into log file, the log file is at `$kuiper_install/log/stream.log` by default.
 
 
 | Property name      | Optional | Description                                                  |
 | Property name      | Optional | Description                                                  |
 | ------------------ | -------- | ------------------------------------------------------------ |
 | ------------------ | -------- | ------------------------------------------------------------ |
-| log             | true | true/false - print the sink result to log or not. By default is ``false``, that will not print the result to log file. |
+| log             | true | true/false - print the sink result to log or not. By default is `false`, that will not print the result to log file. |
 
 
 
 

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 5 - 5
docs/en_US/rules/sinks/rest.md


+ 2 - 2
docs/zh_CN/rules/sinks/edgex.md

@@ -4,8 +4,8 @@
 
 
 | 名称        | 可选 | Description                                                  |
 | 名称        | 可选 | Description                                                  |
 | ----------- | -------- | ------------------------------------------------------------ |
 | ----------- | -------- | ------------------------------------------------------------ |
-| protocol    | true     | 如未指定,使用缺省值 `tcp`.                                |
-| host        | 是    | 消息总线目标主机地址,使用缺省值 `*`.                      |
+| protocol    | true     | 协议,如未指定,使用缺省值 `tcp`.                             |
+| host        | 是    | 消息总线主机地址,使用缺省值 `*`.                      |
 | port        | 是    | 消息总线端口号。 如未指定,使用缺省值 `5563`.              |
 | port        | 是    | 消息总线端口号。 如未指定,使用缺省值 `5563`.              |
 | topic       | 是    | 发布的主题名称,如未指定,使用缺省值 `events`.             |
 | topic       | 是    | 发布的主题名称,如未指定,使用缺省值 `events`.             |
 | contentType | 是    | 发布消息的内容类型,如未指定,使用缺省值 `application/json`. |
 | contentType | 是    | 发布消息的内容类型,如未指定,使用缺省值 `application/json`. |

+ 50 - 50
docs/zh_CN/rules/sinks/mqtt.md

@@ -1,50 +1,50 @@
-# MQTT动作
-
-该操作用于将输出消息发布到 MQTT 服务器中。
-
-| 属性名称 | 是否可选 | 说明                                          |
-| ------------- | -------- | ---------------------------------------------------- |
-| server        | 否    | mqtt  服务器的代理地址,例如 `tcp://127.0.0.1:1883` |
-| topic          | 否    | mqtt 主题,例如``分析/结果``                         |
-| clientId      | 是     | mqtt 连接的客户端 ID。 如果未指定,将使用一个 uuid   |
-| protocolVersion   | 是    | 3.1 (也被称为 MQTT 3) 或者 3.1.1 (也被称为 MQTT 4)。 如果未指定,缺省值为 3.1。|
-| qos               | 是    | 消息转发的服务质量                               |
-| username          | 是    | 连接用户名                            |
-| password          | 是    | 连接密码                             |
-| certificationPath | 是    | 证书路径。可以为绝对路径,也可以为相对路径。如果指定的是相对路径,那么父目录为执行 `server` 命令的路径。比如,如果你在 `/var/kuiper` 中运行 `bin/server` ,那么父目录为 `/var/kuiper`; 如果运行从 `/var/kuiper/bin` 中运行`./server`,那么父目录为 `/var/kuiper/bin`。 |
-| privateKeyPath    | 是    | 私钥路径。可以为绝对路径,也可以为相对路径。更详细的信息,请参考 `certificationPath`. |
-| insecureSkipVerify | true     | 如果 InsecureSkipVerify 设置为 ``true``, TLS接受服务器提供的任何证书以及该证书中的任何主机名。 在这种模式下,TLS容易受到中间人攻击。默认值为``false``。配置项只能用于TLS连接。|
-| retained           | true     | 如果 retained 设置为 ``true``,Broker会存储每个Topic的最后一条保留消息及其Qos。默认值是``false``   
-
-以下为使用 SAS 连接到 Azure IoT Hub 的样例。
-```json
-    {
-      "mqtt": {
-        "server": "ssl://xyz.azure-devices.net:8883",
-        "topic": "devices/demo_001/messages/events/",
-        "protocolVersion": "3.1.1",
-        "qos": 1,
-        "clientId": "demo_001",
-        "username": "xyz.azure-devices.net/demo_001/?api-version=2018-06-30",
-        "password": "SharedAccessSignature sr=*******************",
-        "retained": false
-      }
-    }
-```
-
-以下为使用证书和私钥连接到 AWS IoT的另一个样例。
-
-```json
-    {
-      "mqtt": {
-        "server": "ssl://xyz-ats.iot.us-east-1.amazonaws.com:8883",
-        "topic": "devices/result",
-        "qos": 1,
-        "clientId": "demo_001",
-        "certificationPath": "keys/d3807d9fa5-certificate.pem",
-        "privateKeyPath": "keys/d3807d9fa5-private.pem.key",
-        "retained": false
-      }
-    }
-```
-
+# MQTT动作
+
+该操作用于将输出消息发布到 MQTT 服务器中。
+
+| 属性名称 | 是否可选 | 说明                                          |
+| ------------- | -------- | ---------------------------------------------------- |
+| server        | 否    | MQTT  服务器地址,例如 `tcp://127.0.0.1:1883` |
+| topic          | 否    | MQTT 主题,例如 `analysis/result`                     |
+| clientId      | 是     | MQTT 连接的客户端 ID。 如果未指定,将使用一个 uuid |
+| protocolVersion   | 是    | MQTT 协议版本。3.1 (也被称为 MQTT 3) 或者 3.1.1 (也被称为 MQTT 4)。 如果未指定,缺省值为 3.1。 |
+| qos               | 是    | 消息转发的服务质量                               |
+| username          | 是    | 连接用户名                            |
+| password          | 是    | 连接密码                             |
+| certificationPath | 是    | 证书路径。可以为绝对路径,也可以为相对路径。如果指定的是相对路径,那么父目录为执行 `server` 命令的路径。比如,如果你在 `/var/kuiper` 中运行 `bin/server` ,那么父目录为 `/var/kuiper`; 如果运行从 `/var/kuiper/bin` 中运行`./server`,那么父目录为 `/var/kuiper/bin`。 |
+| privateKeyPath    | 是    | 私钥路径。可以为绝对路径,也可以为相对路径,相对路径的用法与 `certificationPath` 类似。 |
+| insecureSkipVerify | true     | 如果 InsecureSkipVerify 设置为 `true`, TLS接受服务器提供的任何证书以及该证书中的任何主机名。 在这种模式下,TLS容易受到中间人攻击。默认值为`false`。配置项只能用于TLS连接。|
+| retained           | true     | 如果 retained 设置为 `true`,Broker会存储每个Topic的最后一条保留消息及其Qos。默认值是 `false`   
+
+以下为使用 SAS 连接到 Azure IoT Hub 的样例。
+```json
+    {
+      "mqtt": {
+        "server": "ssl://xyz.azure-devices.net:8883",
+        "topic": "devices/demo_001/messages/events/",
+        "protocolVersion": "3.1.1",
+        "qos": 1,
+        "clientId": "demo_001",
+        "username": "xyz.azure-devices.net/demo_001/?api-version=2018-06-30",
+        "password": "SharedAccessSignature sr=*******************",
+        "retained": false
+      }
+    }
+```
+
+以下为使用证书和私钥连接到 AWS IoT的另一个样例。
+
+```json
+    {
+      "mqtt": {
+        "server": "ssl://xyz-ats.iot.us-east-1.amazonaws.com:8883",
+        "topic": "devices/result",
+        "qos": 1,
+        "clientId": "demo_001",
+        "certificationPath": "keys/d3807d9fa5-certificate.pem",
+        "privateKeyPath": "keys/d3807d9fa5-private.pem.key",
+        "retained": false
+      }
+    }
+```
+

+ 1 - 1
docs/zh_CN/rules/sinks/nop.md

@@ -1,6 +1,6 @@
 # Nop action
 # Nop action
 
 
-该 action 是一个空操作目标,所有发送到此的结果将被忽略。如果指定 ``log`` 属性为 `true`,那么结果将会保存到日志文件,日志文件缺省保存在  `$kuiper_install/log/stream.log`。
+该 action 是一个空操作目标,所有发送到此的结果将被忽略。如果指定 `log` 属性为 `true`,那么结果将会保存到日志文件,日志文件缺省保存在  `$kuiper_install/log/stream.log`。
 
 
 | 属性名称  | 是否可选 | 说明                                                  |
 | 属性名称  | 是否可选 | 说明                                                  |
 | ------------------ | -------- | ------------------------------------------------------------ |
 | ------------------ | -------- | ------------------------------------------------------------ |

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 6 - 5
docs/zh_CN/rules/sinks/rest.md


plugins/sinks/file.json → etc/sinks/file.json


plugins/sinks/influxdb.json → etc/sinks/influxdb.json


+ 328 - 0
etc/sinks/internal/edgex.json

@@ -0,0 +1,328 @@
+{
+  "about": {
+    "trial": false,
+    "author": {
+      "name": "EMQ",
+      "email": "contact@emqx.io",
+      "company": "EMQ Technologies Co., Ltd",
+      "website": "https://www.emqx.io"
+    },
+    "helpUrl": {
+      "en_US": "https://github.com/emqx/kuiper/blob/master/docs/en_US/rules/sinks/mqtt.md",
+      "zh_CN": "https://github.com/emqx/kuiper/blob/master/docs/zh_CN/rules/sinks/mqtt.md"
+    },
+    "description": {
+      "en_US": "The action is used for publish output message into an MQTT server.",
+      "zh_CN": "该操作用于将输出消息发布到 MQTT 服务器中"
+    }
+  },
+  "properties": [
+    {
+      "name": "protocol",
+      "default": "tcp",
+      "optional": true,
+      "control": "select",
+      "values": [
+        "tcp"
+      ],
+      "type": "list_string",
+      "hint": {
+        "en_US": "The protocol. If it's not specified, then use default value 'tcp'.",
+        "zh_CN": "协议,如未指定,使用缺省值 tcp。"
+      },
+      "label": {
+        "en_US": "Protocol",
+        "zh_CN": "协议"
+      }
+    },
+    {
+      "name": "host",
+      "optional": true,
+      "control": "text",
+      "default": "*",
+      "type": "string",
+      "hint": {
+        "en_US": "The host of message bus. If not specified, then use default value '*'",
+        "zh_CN": "消息总线主机地址,使用缺省值 *."
+      },
+      "label": {
+        "en_US": "Binding host",
+        "zh_CN": "绑定主机"
+      }
+    },
+    {
+      "name": "port",
+      "optional": true,
+      "control": "text",
+      "default": 5563,
+      "type": "int",
+      "hint": {
+        "en_US": "The port of message bus",
+        "zh_CN": "消息总线端口号"
+      },
+      "label": {
+        "en_US": "Port",
+        "zh_CN": "端口"
+      }
+    },
+    {
+      "name": "topic",
+      "default": "events",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "The topic to be published. If not specified, then use default value 'events'.",
+        "zh_CN": "发布的主题名称,如未指定,使用缺省值 events."
+      },
+      "label": {
+        "en_US": "Topic",
+        "zh_CN": "主题"
+      }
+    },
+    {
+      "name": "contentType",
+      "default": "application/json",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "The content type of message to be published. If not specified, then use the default value 'application/json'.",
+        "zh_CN": "发布消息的内容类型,如未指定,则使用缺省值 application/json."
+      },
+      "label": {
+        "en_US": "Content type",
+        "zh_CN": "内容类型"
+      }
+    },
+    {
+      "name": "metadata",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "The property is a field name that allows user to specify a field name of SQL  select clause,  the field name should use meta(*) AS xxx  to select all of EdgeX metadata from message.",
+        "zh_CN": "该属性为一个字段名称,该字段是 SQL SELECT 子句的一个字段名称,这个字段应该类似于 meta(*) AS xxx ,用于选出消息中所有的 EdgeX 元数据."
+      },
+      "label": {
+        "en_US": "Metadata field name",
+        "zh_CN": "元数据字段名"
+      }
+    },
+    {
+      "name": "deviceName",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "Allows user to specify the device name in the event structure that are sent from Kuiper.",
+        "zh_CN": "允许用户指定设备名称,该名称将作为从 Kuiper 中发送出来的 Event 结构体的设备名称"
+      },
+      "label": {
+        "en_US": "Device name",
+        "zh_CN": "设备名称"
+      }
+    },
+    {
+      "name": "type",
+      "default": "zero",
+      "optional": true,
+      "control": "select",
+      "values": [
+        "mqtt",
+        "zero"
+      ],
+      "type": "string_list",
+      "hint": {
+        "en_US": "The message bus type, two types of message buses are supported, 'zero' or 'mqtt', and 'zero' is the default value.",
+        "zh_CN": "消息总线类型,目前支持两种类型的消息总线,'zero' 或者 'mqtt',其中 'zero' 为缺省类型。"
+      },
+      "label": {
+        "en_US": "Message bus type",
+        "zh_CN": "消息总线类型"
+      }
+    },
+    {
+      "name": "optional.ClientId",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "MQTT clientID",
+        "zh_CN": "MQTT 客户端 ID"
+      },
+      "label": {
+        "en_US": "MQTT clientID",
+        "zh_CN": "MQTT 客户端 ID"
+      }
+    },
+    {
+      "name": "optional.Username",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "MQTT username",
+        "zh_CN": "MQTT 用户名"
+      },
+      "label": {
+        "en_US": "MQTT username",
+        "zh_CN": "MQTT 用户名"
+      }
+    },
+    {
+      "name": "optional.Password",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "MQTT password",
+        "zh_CN": "MQTT 密码"
+      },
+      "label": {
+        "en_US": "MQTT password",
+        "zh_CN": "MQTT 密码"
+      }
+    },
+    {
+      "name": "optional.Qos",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "MQTT QoS",
+        "zh_CN": "MQTT 服务质量"
+      },
+      "label": {
+        "en_US": "MQTT QoS",
+        "zh_CN": "MQTT 服务质量"
+      }
+    },
+    {
+      "name": "optional.KeepAlive",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "MQTT keepalive",
+        "zh_CN": "MQTT keepalive"
+      },
+      "label": {
+        "en_US": "MQTT keepalive",
+        "zh_CN": "MQTT keepalive"
+      }
+    },
+    {
+      "name": "optional.Retained",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "MQTT retained",
+        "zh_CN": "MQTT retained"
+      },
+      "label": {
+        "en_US": "MQTT retained",
+        "zh_CN": "MQTT retained"
+      }
+    },
+    {
+      "name": "optional.ConnectionPayload",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "MQTT connection payload",
+        "zh_CN": "MQTT connection payload"
+      },
+      "label": {
+        "en_US": "MQTT connection payload",
+        "zh_CN": "MQTT connection payload"
+      }
+    },
+    {
+      "name": "optional.CertFile",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "MQTT cert file",
+        "zh_CN": "MQTT cert file"
+      },
+      "label": {
+        "en_US": "MQTT cert file",
+        "zh_CN": "MQTT cert file"
+      }
+    },
+    {
+      "name": "optional.KeyFile",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "MQTT key file",
+        "zh_CN": "MQTT key file"
+      },
+      "label": {
+        "en_US": "MQTT key file",
+        "zh_CN": "MQTT key file"
+      }
+    },
+    {
+      "name": "optional.CertPEMBlock",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "MQTT cert PEM block",
+        "zh_CN": "MQTT cert PEM block"
+      },
+      "label": {
+        "en_US": "MQTT cert PEM block",
+        "zh_CN": "MQTT cert PEM block"
+      }
+    },
+    {
+      "name": "optional.KeyPEMBlock",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "MQTT key PEM block",
+        "zh_CN": "MQTT key PEM block"
+      },
+      "label": {
+        "en_US": "MQTT key PEM block",
+        "zh_CN": "MQTT key PEM block"
+      }
+    },
+    {
+      "name": "optional.SkipCertVerify",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "MQTT skip cert verify",
+        "zh_CN": "MQTT skip cert verify"
+      },
+      "label": {
+        "en_US": "MQTT skip cert verify",
+        "zh_CN": "MQTT skip cert verify"
+      }
+    }
+  ]
+}

+ 21 - 0
etc/sinks/internal/log.json

@@ -0,0 +1,21 @@
+{
+  "about": {
+    "trial": false,
+    "author": {
+      "name": "EMQ",
+      "email": "contact@emqx.io",
+      "company": "EMQ Technologies Co., Ltd",
+      "website": "https://www.emqx.io"
+    },
+    "helpUrl": {
+      "en_US": "https://github.com/emqx/kuiper/blob/master/docs/en_US/rules/sinks/mqtt.md",
+      "zh_CN": "https://github.com/emqx/kuiper/blob/master/docs/zh_CN/rules/sinks/mqtt.md"
+    },
+    "description": {
+      "en_US": "The action is used for print output message into log file, the log file is at $kuiper_install/log/stream.log by default.",
+      "zh_CN": "该操作用于将输出消息打印到日志文件中,默认情况下,该日志文件位于 $kuiper_install/log/stream.log 中。"
+    }
+  },
+  "properties": [
+  ]
+}

+ 180 - 0
etc/sinks/internal/mqtt.json

@@ -0,0 +1,180 @@
+{
+  "about": {
+    "trial": false,
+    "author": {
+      "name": "EMQ",
+      "email": "contact@emqx.io",
+      "company": "EMQ Technologies Co., Ltd",
+      "website": "https://www.emqx.io"
+    },
+    "helpUrl": {
+      "en_US": "https://github.com/emqx/kuiper/blob/master/docs/en_US/rules/sinks/mqtt.md",
+      "zh_CN": "https://github.com/emqx/kuiper/blob/master/docs/zh_CN/rules/sinks/mqtt.md"
+    },
+    "description": {
+      "en_US": "The action is used for publish output message into an MQTT server.",
+      "zh_CN": "该操作用于将输出消息发布到 MQTT 服务器中"
+    }
+  },
+  "properties": [
+    {
+      "name": "server",
+      "default": "tcp://127.0.0.1:1883",
+      "optional": false,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "The broker address of the MQTT server, such as tcp://127.0.0.1:1883.",
+        "zh_CN": "MQTT 服务器地址,例如 tcp://127.0.0.1:1883"
+      },
+      "label": {
+        "en_US": "MQTT broker address",
+        "zh_CN": "MQTT 服务器地址"
+      }
+    },
+    {
+      "name": "topic",
+      "optional": false,
+      "control": "text",
+      "default": "",
+      "type": "string",
+      "hint": {
+        "en_US": "The MQTT topic, such as analysis/result",
+        "zh_CN": "MQTT 主题,例如 analysis/result"
+      },
+      "label": {
+        "en_US": "MQTT topic",
+        "zh_CN": "MQTT 主题"
+      }
+    },
+    {
+      "name": "clientId",
+      "optional": true,
+      "control": "text",
+      "default": "",
+      "type": "string",
+      "hint": {
+        "en_US": "The client id for MQTT connection. If not specified, an uuid will be used",
+        "zh_CN": "MQTT 连接的客户端 ID。 如果未指定,将使用一个 uuid"
+      },
+      "label": {
+        "en_US": "MQTT ClinetID",
+        "zh_CN": "MQTT 客户端标识符(ClinetID)"
+      }
+    },
+    {
+      "name": "protocolVersion",
+      "default": "3.1",
+      "optional": true,
+      "control": "select",
+      "values": [
+        "3.1",
+        "3.1.1"
+      ],
+      "type": "string",
+      "hint": {
+        "en_US": "MQTT protocol version. 3.1 (also refer as MQTT 3) or 3.1.1 (also refer as MQTT 4).  If not specified, the default value is 3.1.",
+        "zh_CN": "MQTT 协议版本。3.1 (也被称为 MQTT 3) 或者 3.1.1 (也被称为 MQTT 4)。 如果未指定,缺省值为 3.1。"
+      },
+      "label": {
+        "en_US": "MQTT protocol version",
+        "zh_CN": "MQTT 协议版本"
+      }
+    },
+    {
+      "name": "qos",
+      "default": 0,
+      "optional": true,
+      "control": "select",
+      "values": [
+        0,
+        1,
+        2
+      ],
+      "type": "list_int",
+      "hint": {
+        "en_US": "The QoS for message delivery.",
+        "zh_CN": "消息转发的服务质量"
+      },
+      "label": {
+        "en_US": "QoS",
+        "zh_CN": "QoS"
+      }
+    },
+    {
+      "name": "username",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "The username for the connection.",
+        "zh_CN": "连接用户名"
+      },
+      "label": {
+        "en_US": "Username",
+        "zh_CN": "用户名"
+      }
+    },
+    {
+      "name": "password",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "The password for the connection.",
+        "zh_CN": "连接密码。"
+      },
+      "label": {
+        "en_US": "Password",
+        "zh_CN": "密码"
+      }
+    },
+    {
+      "name": "certificationPath",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "The certification path. It can be an absolute path, or a relative path. If it is an relative path, then the base path is where you excuting the server command. For example, if you run bin/server from /var/kuiper, then the base path is /var/kuiper; If you run ./server from /var/kuiper/bin, then the base path is /var/kuiper/bin.",
+        "zh_CN": "证书路径。可以为绝对路径,也可以为相对路径。如果指定的是相对路径,那么父目录为执行 server 命令的路径。比如,如果你在 /var/kuiper 中运行 bin/server ,那么父目录为 /var/kuiper; 如果运行从 /var/kuiper/bin 中运行./server,那么父目录为 /var/kuiper/bin"
+      },
+      "label": {
+        "en_US": "Certification path",
+        "zh_CN": "证书路径"
+      }
+    },
+    {
+      "name": "privateKeyPath",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "The private key path. It can be either absolute path, or relative path, which is similar to use of certificationPath.",
+        "zh_CN": "私钥路径。可以为绝对路径,也可以为相对路径,相对路径的用法与 certificationPath 类似"
+      },
+      "label": {
+        "en_US": "Certification path",
+        "zh_CN": "证书路径"
+      }
+    },
+    {
+      "name": "insecureSkipVerify",
+      "default": true,
+      "optional": true,
+      "control": "radio",
+      "type": "bool",
+      "hint": {
+        "en_US": "If InsecureSkipVerify is true, TLS accepts any certificate presented by the server and any host name in that certificate.  In this mode, TLS is susceptible to man-in-the-middle attacks. The default value is false. The configuration item can only be used with TLS connections.",
+        "zh_CN": "如果 InsecureSkipVerify 设置为 true, TLS接受服务器提供的任何证书以及该证书中的任何主机名。 在这种模式下,TLS容易受到中间人攻击。默认值为false。配置项只能用于TLS连接。"
+      },
+      "label": {
+        "en_US": "Insecure skip verify",
+        "zh_CN": "非安全跳过验证"
+      }
+    }
+  ]
+}

+ 36 - 0
etc/sinks/internal/nop.json

@@ -0,0 +1,36 @@
+{
+  "about": {
+    "trial": false,
+    "author": {
+      "name": "EMQ",
+      "email": "contact@emqx.io",
+      "company": "EMQ Technologies Co., Ltd",
+      "website": "https://www.emqx.io"
+    },
+    "helpUrl": {
+      "en_US": "https://github.com/emqx/kuiper/blob/master/docs/en_US/rules/sinks/nop.md",
+      "zh_CN": "https://github.com/emqx/kuiper/blob/master/docs/zh_CN/rules/sinks/nop.md"
+    },
+    "description": {
+      "en_US": "The action is an Nop sink, the result sent to this sink will be ignored. ",
+      "zh_CN": "空操作目标,所有发送到此的结果将被忽略。"
+    }
+  },
+  "properties": [
+    {
+      "name": "log",
+      "default": false,
+      "optional": true,
+      "control": "radio",
+      "type": "bool",
+      "hint": {
+        "en_US": "Print the sink result to log or not. By default is false, that will not print the result to log file.",
+        "zh_CN": "是否将结果打印到日志。缺省为 false,这种情况下将不会打印到日志文件。"
+      },
+      "label": {
+        "en_US": "Print log",
+        "zh_CN": "打印日志"
+      }
+    }
+  ]
+}

+ 142 - 0
etc/sinks/internal/rest.json

@@ -0,0 +1,142 @@
+{
+  "about": {
+    "trial": false,
+    "author": {
+      "name": "EMQ",
+      "email": "contact@emqx.io",
+      "company": "EMQ Technologies Co., Ltd",
+      "website": "https://www.emqx.io"
+    },
+    "helpUrl": {
+      "en_US": "https://github.com/emqx/kuiper/blob/master/docs/en_US/rules/sinks/rest.md",
+      "zh_CN": "https://github.com/emqx/kuiper/blob/master/docs/zh_CN/rules/sinks/rest.md"
+    },
+    "description": {
+      "en_US": "The action is used for publish output message into a RESTful API.",
+      "zh_CN": "该动作用于将输出消息发布到 RESTful API 中。"
+    }
+  },
+  "properties": [
+    {
+      "name": "url",
+      "default": "",
+      "optional": false,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "The RESTful API endpoint, such as https://www.example.com/api/dummy",
+        "zh_CN": "RESTful API 终端地址,例如 https://www.example.com/api/dummy"
+      },
+      "label": {
+        "en_US": "URL",
+        "zh_CN": "地址"
+      }
+    },
+    {
+      "name": "method",
+      "optional": true,
+      "control": "select",
+      "default": "GET",
+      "type": "list_string",
+      "values": [
+        "GET",
+        "POST",
+        "PUT",
+        "DELETE",
+        "HEAD"
+      ],
+      "hint": {
+        "en_US": "The HTTP method for the RESTful API.",
+        "zh_CN": "RESTful API 的 HTTP 方法。"
+      },
+      "label": {
+        "en_US": "HTTP method",
+        "zh_CN": "HTTP 方法"
+      }
+    },
+    {
+      "name": "bodyType",
+      "optional": true,
+      "control": "select",
+      "default": "none",
+      "type": "list_string",
+      "values": [
+        "none",
+        "json",
+        "text",
+        "html",
+        "xml",
+        "javascript",
+        "form"
+      ],
+      "hint": {
+        "en_US": "The type of the body. For \"get\" and \"head\", no body is required so the default value is \"none\". For other http methods, the default value is \"json\" For \"html\", \"xml\" and \"javascript\", the dataTemplate must be carefully set up to make sure the format is correct.",
+        "zh_CN": "消息体的类型。对于 \"get\" 和 \"head\",不需要正文,因此默认值为 \"none\"。 对于其他 http 方法,默认值为 \"json\"。对于 \"html\",\"xml\" 和 \"javascript\",必须仔细设置 dataTemplate 以确保格式正确。"
+      },
+      "label": {
+        "en_US": "Body type",
+        "zh_CN": "消息体类型"
+      }
+    },
+    {
+      "name": "timeout",
+      "default": 5000,
+      "optional": true,
+      "control": "text",
+      "type": "int",
+      "hint": {
+        "en_US": "The timeout (milliseconds) for a HTTP request, defaults to 5000 ms",
+        "zh_CN": "HTTP 请求超时的时间(毫秒),默认为5000毫秒"
+      },
+      "label": {
+        "en_US": "Timeout(ms)",
+        "zh_CN": "超时(ms)"
+      }
+    },
+    {
+      "name": "headers",
+      "default": "",
+      "optional": true,
+      "control": "text",
+      "type": "string",
+      "hint": {
+        "en_US": "The additional headers to be set for the HTTP request.",
+        "zh_CN": "要为 HTTP 请求设置的其他标头"
+      },
+      "label": {
+        "en_US": "HTTP headers",
+        "zh_CN": "HTTP 头"
+      }
+    },
+    {
+      "name": "insecureSkipVerify",
+      "default": true,
+      "optional": true,
+      "control": "radio",
+      "type": "bool",
+      "hint": {
+        "en_US": "Control if to skip the certification verification. If it is set to true, then skip certification verification; Otherwise, verify the certification.",
+        "zh_CN": "控制是否跳过证书认证。如果被设置为 true,那么跳过证书认证;否则进行证书验证。"
+      },
+      "label": {
+        "en_US": "Certification verification",
+        "zh_CN": "证书验证"
+      }
+    },
+    {
+      "name": "debugResp",
+      "default": true,
+      "optional": true,
+      "control": "radio",
+      "type": "bool",
+      "hint": {
+        "en_US": "Control if print the response information into the console. If set it to true, then print response; If set to false, then skip print log.",
+        "zh_CN": "控制是否将响应信息打印到控制台中。 如果将其设置为 true,则打印响应;如果设置为 false,则跳过打印日志。"
+      },
+      "label": {
+        "en_US": "Print HTTP response",
+        "zh_CN": "打印 HTTP 响应"
+      }
+    }
+  ]
+}

plugins/sinks/options.json → etc/sinks/options.json


plugins/sinks/properties.json → etc/sinks/properties.json


plugins/sinks/taos.json → etc/sinks/taos.json


plugins/sinks/zmq.json → etc/sinks/zmq.json


+ 34 - 14
plugins/sinkMeta.go

@@ -6,6 +6,7 @@ import (
 	"github.com/emqx/kuiper/xstream/api"
 	"github.com/emqx/kuiper/xstream/api"
 	"io/ioutil"
 	"io/ioutil"
 	"path"
 	"path"
+	"sort"
 	"strings"
 	"strings"
 )
 )
 
 
@@ -44,41 +45,59 @@ type (
 )
 )
 
 
 var g_sinkMetadata map[string]*sinkMeta //map[fileName]
 var g_sinkMetadata map[string]*sinkMeta //map[fileName]
+
+//const internal sinks
+var InternalSinks = [...]string{"log", "mqtt", "rest", "nop", "edgex"}
+
 func (this *Manager) readSinkMetaDir() error {
 func (this *Manager) readSinkMetaDir() error {
-	confDir, err := common.GetLoc("/plugins")
+	confDir, err := common.GetConfLoc()
 	if nil != err {
 	if nil != err {
 		return err
 		return err
 	}
 	}
 
 
 	dir := path.Join(confDir, "sinks")
 	dir := path.Join(confDir, "sinks")
 	tmpMap := make(map[string]*sinkMeta)
 	tmpMap := make(map[string]*sinkMeta)
-	infos, err := ioutil.ReadDir(dir)
+
+	//The internal support sinks
+	for _, sink := range InternalSinks {
+		file := path.Join(confDir, "sinks", "internal", sink + ".json")
+		common.Log.Infof("Loading metadata file for sink: %s", file)
+		meta := new(sinkMeta)
+		err := common.ReadJsonUnmarshal(file, meta)
+		if nil != err {
+			return fmt.Errorf("Failed to load internal sink plugin:%s with err:%v", file, err)
+		}
+		tmpMap[sink + ".json"] = meta
+	}
+
+	files, err := ioutil.ReadDir(dir)
 	if nil != err {
 	if nil != err {
 		return err
 		return err
 	}
 	}
-	for _, info := range infos {
-		fileName := info.Name()
-		if !strings.HasSuffix(fileName, ".json") {
+	for _, file := range files {
+		fname := file.Name()
+		if !strings.HasSuffix(fname, ".json") {
 			continue
 			continue
 		}
 		}
 
 
-		filePath := path.Join(dir, fileName)
-		ptrMetadata := new(sinkMeta)
-		err = common.ReadJsonUnmarshal(filePath, ptrMetadata)
+		filePath := path.Join(dir, fname)
+		metadata := new(sinkMeta)
+		err = common.ReadJsonUnmarshal(filePath, metadata)
 		if nil != err {
 		if nil != err {
-			return fmt.Errorf("fileName:%s err:%v", fileName, err)
+			return fmt.Errorf("fname:%s err:%v", fname, err)
 		}
 		}
 
 
-		common.Log.Infof("sinkMeta file : %s", fileName)
-		tmpMap[fileName] = ptrMetadata
+		common.Log.Infof("sinkMeta file : %s", fname)
+		tmpMap[fname] = metadata
 	}
 	}
+
 	g_sinkMetadata = tmpMap
 	g_sinkMetadata = tmpMap
 	return nil
 	return nil
 }
 }
 
 
 func (this *Manager) readSinkMetaFile(filePath string) error {
 func (this *Manager) readSinkMetaFile(filePath string) error {
-	ptrMetadata := new(sinkMeta)
-	err := common.ReadJsonUnmarshal(filePath, ptrMetadata)
+	metadata := new(sinkMeta)
+	err := common.ReadJsonUnmarshal(filePath, metadata)
 	if nil != err {
 	if nil != err {
 		return fmt.Errorf("filePath:%s err:%v", filePath, err)
 		return fmt.Errorf("filePath:%s err:%v", filePath, err)
 	}
 	}
@@ -90,7 +109,7 @@ func (this *Manager) readSinkMetaFile(filePath string) error {
 	}
 	}
 	fileName := path.Base(filePath)
 	fileName := path.Base(filePath)
 	common.Log.Infof("sinkMeta file : %s", fileName)
 	common.Log.Infof("sinkMeta file : %s", fileName)
-	tmpMap[fileName] = ptrMetadata
+	tmpMap[fileName] = metadata
 	g_sinkMetadata = tmpMap
 	g_sinkMetadata = tmpMap
 	return nil
 	return nil
 }
 }
@@ -289,5 +308,6 @@ func (this *Manager) GetSinks() (sinks []string) {
 		}
 		}
 		sinks = append(sinks, strings.TrimSuffix(fileName, `.json`))
 		sinks = append(sinks, strings.TrimSuffix(fileName, `.json`))
 	}
 	}
+	sort.Sort(sort.StringSlice(sinks))
 	return sinks
 	return sinks
 }
 }