IoTHub, Blob Storage, and Function Applications: Building Hot and Cold Paths
Want to learn more about using IoTHub, Blob storage, and Function App to configure cold and hot paths for data processing? Click here to read more!
Join the DZone community and get the full member experience.Join For Free
Building cold and hot paths for data from IoT devices in Azure is a task that should be included in every IoT project. Building the data flow from devices into an analytic service and backup in Azure is both simple and effective. Let's take a look at the step-by-step implementation for this task:
To create IotHub, check the official docs — create the IoTHub.
To learn how to create a device emulator, check the official docs here on how to create device emulators for IoTHub.
To create Blob storage, check the official docs on how to create storage.
Function App Service Plan
To create the function app service itself, check official docs on how to create a Function App.
Configuring Function App
After creating the App Service Plan for the Function App, we have to create a proper type of our function itself. We have to choose the right trigger for it.
Choose to create a new function with EventHub trigger:
Run the function as it is to open log streaming and see what is going on.
Run your device emulator to check if the messages are received via the Function App.
Nice! We are receiving messages into our IoTHub, and from IoTHub, they are delivered into the Function App.
Configuring Route and Endpoint for
Go to your IoTHub and add new Custom Endpoint. Even in the Free plan in IoTHub, you are able to create one additional custom endpoint, what is enough for our case.
Routes — after, add two new Routes.
First, we need to send data into Blob storage.
Second, we need to send data into the events endpoint, which is connected our Function App trigger.
Rules for Routes should be the same. After the restart, you should see your message arriving in your Function App logs,
NOTE: Files in Blob Storage are saved in the serialized format, AVRO. So when you access the file, you will see non-human-readable data.
Opinions expressed by DZone contributors are their own.