Bläddra i källkod

doc<stream>: add concurrency and runAsync doc

ngjaying 5 år sedan
förälder
incheckning
8a0517b5ca

+ 6 - 2
docs/en_US/extension/source.md

@@ -4,9 +4,9 @@ Sources feed data into Kuiper from other systems. Kuiper has built-in source sup
 
 
 ## Developing
 ## Developing
 
 
-### Develop a sink
+### Develop a source
 
 
-To develop a sink for Kuiper is to implement [api.Sink](../../../xstream/api/stream.go) interface and export it as a golang plugin.
+To develop a source for Kuiper is to implement [api.Source](../../../xstream/api/stream.go) interface and export it as a golang plugin.
 
 
 Before starting the development, you must [setup the environment for golang plugin](overview.md#setup-the-plugin-developing-environment). 
 Before starting the development, you must [setup the environment for golang plugin](overview.md#setup-the-plugin-developing-environment). 
 
 
@@ -51,6 +51,10 @@ A configuration system is supported for Kuiper extension which will automaticall
  1. The name of your configuration file must be the same as the _.so_ file and must be camel case with upper case first letter. For example, MySource.yaml.
  1. The name of your configuration file must be the same as the _.so_ file and must be camel case with upper case first letter. For example, MySource.yaml.
  2. The yaml file must be located inside _etc/sources_
  2. The yaml file must be located inside _etc/sources_
  3. The format of the yaml file could be found [here](../rules/sources/mqtt.md)
  3. The format of the yaml file could be found [here](../rules/sources/mqtt.md)
+ 
+#### common configuration field
+
+There is a common configuration field ``concurrency`` to specify how many instances will be started to run the source.
 
 
 ### Package the source
 ### Package the source
 Build the implemented source as a go plugin and make sure the output so file resides in the plugins/sources folder.
 Build the implemented source as a go plugin and make sure the output so file resides in the plugins/sources folder.

+ 6 - 1
docs/en_US/rules/overview.md

@@ -45,7 +45,12 @@ The sql query to run for the rule.
 
 
 ### actions
 ### actions
 
 
-Currently, 3 kinds of actions are supported: [log](sinks/logs.md), [mqtt](sinks/mqtt.md) and [rest](sinks/rest.md). Each action can define its own properties.
+Currently, 3 kinds of actions are supported: [log](sinks/logs.md), [mqtt](sinks/mqtt.md) and [rest](sinks/rest.md). Each action can define its own properties. There are 2 common properties:
+
+| property name | Type & Default Value | Description                                                  |
+| ------------- | -------- | ------------------------------------------------------------ |
+| concurrency | int: 1   | Specify how many instances of the sink will be run. |
+| runAsync        | bool:false   | Whether the sink will run asynchronously for better performance. If it is true, the sink result order is not promised.  |
 
 
 Actions could be customized to support different kinds of outputs, see [extension](../extension/overview.md) for more detailed info.
 Actions could be customized to support different kinds of outputs, see [extension](../extension/overview.md) for more detailed info.
 
 

+ 4 - 0
docs/en_US/rules/sources/mqtt.md

@@ -8,6 +8,7 @@ default:
   qos: 1
   qos: 1
   sharedSubscription: true
   sharedSubscription: true
   servers: [tcp://127.0.0.1:1883]
   servers: [tcp://127.0.0.1:1883]
+  concurrency: 1
   #username: user1
   #username: user1
   #password: password
   #password: password
   #certificationPath: /var/kuiper/xyz-certificate.pem
   #certificationPath: /var/kuiper/xyz-certificate.pem
@@ -29,6 +30,9 @@ Use can specify the global MQTT settings here. The configuration items specified
 
 
 The default subscription QoS level.
 The default subscription QoS level.
 
 
+### concurrency
+How many instances will be started. By default, only an instance will be run. If more than one instance is specified, the topic must be a shared subscription topic.
+
 ### sharedSubscription
 ### sharedSubscription
 
 
 Whether use the shared subscription mode or not. If using the shared subscription mode, then there are multiple Kuiper process can be load balanced.
 Whether use the shared subscription mode or not. If using the shared subscription mode, then there are multiple Kuiper process can be load balanced.

+ 6 - 1
docs/zh_CN/rules/overview.md

@@ -45,7 +45,12 @@
 
 
 ### 动作
 ### 动作
 
 
-当前,支持两种操作: [log](sinks/logs.md) 、[mqtt](sinks/mqtt.md) 和 [rest](sinks/rest.md)。 每个动作可以定义自己的属性。
+当前,支持两种操作: [log](sinks/logs.md) 、[mqtt](sinks/mqtt.md) 和 [rest](sinks/rest.md)。 每个动作可以定义自己的属性。当前有两个公共属性:
+
+| 属性名 | 类型和默认值 | 描述                                                  |
+| ------------- | -------- | ------------------------------------------------------------ |
+| concurrency | int: 1   | 设置运行的线程数。 |
+| runAsync        | bool:false   | 设置是否异步运行输出操作以提升性能。请注意,异步运行的情况下,输出结果顺序不能保证。  |
 
 
 可以自定义动作以支持不同种类的输出,有关更多详细信息,请参见 [extension](../extension/overview.md) 。
 可以自定义动作以支持不同种类的输出,有关更多详细信息,请参见 [extension](../extension/overview.md) 。
 
 

+ 4 - 0
docs/zh_CN/rules/sources/mqtt.md

@@ -8,6 +8,7 @@ default:
   qos: 1
   qos: 1
   sharedsubscription: true
   sharedsubscription: true
   servers: [tcp://127.0.0.1:1883]
   servers: [tcp://127.0.0.1:1883]
+  concurrency: 1
   #username: user1
   #username: user1
   #password: password
   #password: password
   #certificationPath: /var/kuiper/xyz-certificate.pem
   #certificationPath: /var/kuiper/xyz-certificate.pem
@@ -28,6 +29,9 @@ demo: #Conf_key
 
 
 默认订阅QoS级别。
 默认订阅QoS级别。
 
 
+### concurrency
+设置运行的线程数,默认值为1。如果设置进程数大于1,必须使用共享订阅模式。
+
 ### sharedsubscription
 ### sharedsubscription
 
 
 是否使用共享订阅模式。 如果使用共享订阅模式,那么多个Kuiper进程可以进行负载平衡。
 是否使用共享订阅模式。 如果使用共享订阅模式,那么多个Kuiper进程可以进行负载平衡。