简体   繁体   English

AWS IoT规则:获取控制数据包类型

[英]AWS IoT Rule: Get control packet type

I'd like to log MQTT messages to persistent storage and log their control packet type, eg CONNECT, CONNACK, PUBLISH, SUBSCRIBE etc. Specifically I would like to use IoT SQL to only apply a rule where the control packet type is something specific, eg PUBLISH . 我想将MQTT消息记录到持久性存储中,并记录它们的控制包类型,例如CONNECT, CONNACK, PUBLISH, SUBSCRIBE等。具体来说,我想使用IoT SQL仅应用控制包类型特定的规则,例如PUBLISH Is this possible, I didn't see a relevant function to retrieve this information in the docs . 这可能吗,我没有在docs中看到相关的函数来检索此信息。 Something like SELECT *, [control packet type] as method FROM '#' WHERE method = 'PUBLISH' , where the brackets would be replaced with the value I'm looking for. 类似于SELECT *, [control packet type] as method FROM '#' WHERE method = 'PUBLISH' ,其中的括号将替换为我要查找的值。

If you want to use the rules engine then you can infer the control packet type by the relevant topic. 如果要使用规则引擎,则可以通过相关主题推断控制包类型。 Rules that run against reserved topics will allow you to trigger actions based on connect, disconnect, subscribe and unsubscribe control packets. 针对保留主题运行的规则将使您能够基于连接,断开连接,订阅和取消订阅控制数据包触发操作。 A rule on all unreserved topics ('#') will correspond to a publish message. 有关所有未保留主题('#')的规则将与发布消息相对应。

There is also some metadata available in the message broker logs . 消息代理日志中还提供了一些元数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM