我正在开发一个必须在 Azure 中运行的 Java 函数。在我的 IoT 中心中,我定义了一条路由,它会触发所有设备对事件中心的更改。从那里,我的函数被轻松触发,并且我可以记录确实更改的内容。到目前为止一切顺利,但是..
如何提取设备 ID?现在,我只检索消息(设备孪生中已更改的内容),但我不知道此内容更改属于哪个设备。
有人有什么想法吗?
最佳答案
您遇到了known issue事件中心绑定(bind)数据的当前实现缺少一些属性,例如您要查找的设备 ID。
In our binding, we absorbed this change by outputting just the 4 top level properties from that type, not realizing that it derives from Dictionary. So the code where we populate binding data here is a bug. Rather than our own ToDictionary implementation here for these 4 properties (which filters out other system properties), we should just be adding the entire collection, which is already a dictionary.
这是 thread跟踪问题的修复。
关于java - 基于deviceTwinTrigger的Azure Java函数: Retrieve DeviceId,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54220669/