0
votes

Following this guide:https://docs.microsoft.com/nl-nl/azure/azure-functions/functions-bindings-event-hubs#trigger---java-example

I am working on a Java Function, that has to run in Azure. In my IoT-hub I have a route defined, which triggers all device twin changes towards an event hub. From there, my function gets triggered nice and easy, and I can log the content that was indeed changed. So far so good, but..

How can I extract the device id? Right now, I only retrieve the message (content of what has been changed in the device twin) but I have no idea to which device this content change belongs.

Anyone any idea?

2

2 Answers

1
votes

You have met a known issue that current implementation of Event Hub binding data missed some properties like the device id you seek.

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.

And here's the thread tracking the fix for the problem.