java - 基于deviceTwinTrigger的Azure Java函数: Retrieve DeviceId

标签 java azure azure-functions

按照本指南操作:https://learn.microsoft.com/nl-nl/azure/azure-functions/functions-bindings-event-hubs#trigger---java-example

我正在开发一个必须在 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/

相关文章:

java - 使用自定义 jackson 序列化器替换Enum值

java - 创建动态 JavaBean 或将变量动态添加到现有 JavaBean

java - `if else` 和 `if-else if-else` 之间有区别吗?

java - 使用 postgres 独立启动 jackrabbit

azure - 如何在 Azure Active Directory 上配置自定义身份验证服务(使用 Windows Identity Framework 开发)

asp.net - 如何使用 Azure DevOps 部署多个应用程序?

azure - Azure 云 shell 中缺少 New-AzureADPolicy

azure-functions - VS Code 多个项目中的 Azure Functions

c# - Microsoft.NET.Sdk.Functions引起的版本冲突

Azure 函数失败并出现 StorageException