Parcourir la source

doc(edgex): add messageType to edgex source doc

Signed-off-by: Jiyong Huang <huangjy@emqx.io>
Jiyong Huang il y a 3 ans
Parent
commit
25154388ed
2 fichiers modifiés avec 34 ajouts et 8 suppressions
  1. 19 4
      docs/en_US/rules/sources/edgex.md
  2. 15 4
      docs/zh_CN/rules/sources/edgex.md

+ 19 - 4
docs/en_US/rules/sources/edgex.md

@@ -64,6 +64,7 @@ default:
   server: localhost
   server: localhost
   port: 5573
   port: 5573
   topic: events
   topic: events
+  messageType: event
 #  optional:
 #  optional:
 #    ClientId: client1
 #    ClientId: client1
 #    Username: user1
 #    Username: user1
@@ -88,19 +89,33 @@ The port of EdgeX message bus, default value is ``5573``.
 
 
 ### topic
 ### topic
 
 
-The topic name of EdgeX message bus,  default value is ``events``.
+The topic name of EdgeX message bus, default value is ``events``. Users can subscribe to the topics of message bus
+directly or subscribe to topics exported by EdgeX application service. Notice that, the message type of the two types of
+topics are different, remember to set the appropriate messageType property.
 
 
 ### type
 ### type
 
 
-The EdgeX message bus type, currently two types of message buses are supported. If specified other values, then will use the default ``zero`` value.
+The EdgeX message bus type, currently three types of message buses are supported. If specified other values, then will
+use the default ``redis`` value.
 
 
-- ``zero``: Use ZeroMQ as EdgeX message bus. 
+- ``zero``: Use ZeroMQ as EdgeX message bus.
 - ``mqtt``: Use the MQTT broker as EdgeX message bus.
 - ``mqtt``: Use the MQTT broker as EdgeX message bus.
 - ``redis``: Use Redis as EdgeX message bus. When using EdgeX docker compose, the type will be set to this by default.
 - ``redis``: Use Redis as EdgeX message bus. When using EdgeX docker compose, the type will be set to this by default.
 
 
+### messageType
+
+The EdgeX message model type. If connected to the topic of EdgeX application service, the message model is an "event".
+Otherwise, if connected to the topic of EdgeX message bus directly to receive the message from device service or core
+data, the message is a "request". There are two available types of messageType property:
+
+- ``event``: The message will be decoded as a `dtos.Event` type. This is the default.
+- ``request``: The message will be decoded as a `requests.AddEventRequest` type.
+
 ### optional
 ### optional
 
 
-If MQTT message bus is used, some other optional configurations can be specified. Please notice that all of values in optional are **<u>string type</u>**, so values for these configurations should be string - such as ``KeepAlive: "5000"``. Below optional configurations are supported, please check MQTT specification for the detailed information.
+If MQTT message bus is used, some other optional configurations can be specified. Please notice that all of values in
+optional are **<u>string type</u>**, so values for these configurations should be string - such as ``KeepAlive: "5000"``
+. Below optional configurations are supported, please check MQTT specification for the detailed information.
 
 
 - ClientId
 - ClientId
 
 

+ 15 - 4
docs/zh_CN/rules/sources/edgex.md

@@ -66,6 +66,7 @@ default:
   server: localhost
   server: localhost
   port: 5573
   port: 5573
   topic: events
   topic: events
+  messageType: event
 #  optional:
 #  optional:
 #    ClientId: client1
 #    ClientId: client1
 #    Username: user1
 #    Username: user1
@@ -88,19 +89,29 @@ EdgeX 消息总线的端口,缺省为 `5573`
 
 
 ## topic
 ## topic
 
 
-EdgeX 消息总线上监听的主题名称,缺省为 `events`
+EdgeX 消息总线上监听的主题名称,缺省为 `events`。用户可以直接连接到 EdgeX 消息总线上的主题也可以连接到 application service 暴露的主题。需要注意的是,两种主题的消息数据类型不同,需要设置正确的
+messageType 类型。
 
 
 ## type
 ## type
 
 
-EdgeX 消息总线类型,目前支持种消息总线。如果指定了错误的消息总线类型,那么会使用缺省 `zero` 类型。
+EdgeX 消息总线类型,目前支持种消息总线。如果指定了错误的消息总线类型,那么会使用缺省 `zero` 类型。
 
 
-- `zero`:使用 ZeroMQ 类型的消息总线 
+- `zero`:使用 ZeroMQ 类型的消息总线
 - `mqtt`:使用 MQTT 服务器作为消息总线
 - `mqtt`:使用 MQTT 服务器作为消息总线
 - `redis`: 使用 Redis 服务器作为消息总线。使用 EdgeX docker compose 启动时,type参数会默认设置为该类型。
 - `redis`: 使用 Redis 服务器作为消息总线。使用 EdgeX docker compose 启动时,type参数会默认设置为该类型。
 
 
+### messageType
+
+EdgeX 消息模型类型。如果连接到 EdgeX application service 的 topic, 则消息为 "event" 类型。否则,如果直接连接到消息总线的 topic,接收到 device service 或者 core
+data 发出的数据,则消息类型为 "request"。该参数支持两种类型:
+
+- ``event``: 消息将会解码为 `dtos.Event` 类型。该选项为默认值。
+- ``request``: 消息将会解码为 `requests.AddEventRequest` 类型。
+
 ## optional
 ## optional
 
 
-如果使用了 MQTT 消息总线,还可以指定别的一些可选配置项。请注意,所有在可选的配置项里指定的值都必须为**<u>字符类型</u>**,因此这里出现的所有的配置应该是字符类型的 - 例如 `KeepAlive: "5000"`。以下为支持的可选的配置列表,您可以参考 MQTT 协议规范来获取更详尽的信息。
+如果使用了 MQTT 消息总线,还可以指定别的一些可选配置项。请注意,所有在可选的配置项里指定的值都必须为**<u>字符类型</u>**,因此这里出现的所有的配置应该是字符类型的 - 例如 `KeepAlive: "5000"`
+。以下为支持的可选的配置列表,您可以参考 MQTT 协议规范来获取更详尽的信息。
 
 
 - ClientId
 - ClientId