The Azure IoT Hub is the preferred Azure Cloud gateway for IoT Devices.
The format of messages sent by devices to the IoTHub is described in the EventData class.
There, a regular message is split into three data parts:
- The actual message body, the data inside
- System properties, context added by the system (like IoT Hub context)
- Application (aka User) properties, context added by the user
These properties are key value pairs. these are not encoded opposite to the message body which has to be decoded before it is accessible.
So, we see that the original messages can get context along the way.
As a developer, using Azure IoT, adding application/user context can be done at two levels:
We can add application properties to the device message. This is normally done on the device when the message is constructed.
The Azure IoT Hub also supports message enrichment. These enrichments are also added as application/user properties, as seen in my previous blog post.
There, I showed how to read the properties using an Azure Function.
Consuming message context is a little bit of a challenge as seen in that post.
Here, we dive into this using Azure Stream Analytics.Doorgaan met het lezen van “Adding context using EventData properties in Azure Stream Analytics”