DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

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!

Vasyl Kutsyk user avatar by
Vasyl Kutsyk
·
Oct. 24, 18 · Tutorial
Like (1)
Save
Tweet
Share
8.74K Views

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:

Archi

IoTHub

To create IotHub, check the official docs — create the IoTHub.

Device Emulators

To learn how to create a device emulator, check the official docs here on how to create device emulators for IoTHub.

Blob Storage

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.

Logs:

> 2018-06-18T19:06:43  Welcome, you are now connected to log-streaming service.
> 2018-06-18T19:07:04.568 [Info] Function started (Id=a60af5f3-ad37-4a45-a450-2c3ac89fca81)
> 2018-06-18T19:07:04.583 [Info] C# Event Hub trigger function processed a message: Test Message
> 2018-06-18T19:07:04.583 [Info] Function completed (Success, Id=a60af5f3-ad37-4a45-a450-2c3ac89fca81, Duration=11ms)


Run your device emulator to check if the messages are received via the Function App.

Logs:

> 2018-06-18T19:06:43  Welcome, you are now connected to log-streaming service.
> 2018-06-18T19:07:04.568 [Info] Function started (Id=a60af5f3-ad37-4a45-a450-2c3ac89fca81)
> 2018-06-18T19:07:04.583 [Info] C# Event Hub trigger function processed a message: Test Message
> 2018-06-18T19:07:04.583 [Info] Function completed (Success, Id=a60af5f3-ad37-4a45-a450-2c3ac89fca81, Duration=11ms)
> 2018-06-18T19:08:43  No new trace in the past 1 min(s).
> 2018-06-18T19:09:43  No new trace in the past 2 min(s).
> 2018-06-18T19:09:56.815 [Info] Function started (Id=2d9db652-62e6-4ab9-a9a5-ddf8be7d23e4)
> 2018-06-18T19:09:56.815 [Info] C# Event Hub trigger function processed a message: {"deviceId":"AAABBB","time":1529348996,"seqNumber":1,"data":"3015001E0004186DEA983F80","snr":0,"station":"","rssi":0,"ack":false}
> 2018-06-18T19:09:56.815 [Info] Function completed (Success, Id=2d9db652-62e6-4ab9-a9a5-ddf8be7d23e4, Duration=0ms)
> 2018-06-18T19:09:57.862 [Info] Function started


Nice! We are receiving messages into our IoTHub, and from IoTHub, they are delivered into the Function App.

Configuring Route and Endpoint for Cold and Hot Path

Endpoint

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.

app application

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Public Cloud-to-Cloud Repatriation Trend
  • A Real-Time Supply Chain Control Tower Powered by Kafka
  • 2023 Software Testing Trends: A Look Ahead at the Industry's Future
  • The Top 3 Challenges Facing Engineering Leaders Today—And How to Overcome Them

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: