Skip to Content
Azure IoT Development Cookbook
book

Azure IoT Development Cookbook

by Yatish Patil
August 2017
Intermediate to advanced
254 pages
6h 10m
English
Packt Publishing
Content preview from Azure IoT Development Cookbook

How to do it...

We will be creating a simulated IoT device to send telemetry data and read that in the cloud application:

  1. Create a console application in the Visual Studio simulated device.
  2. Add the Azure.Devices package from NuGet.
  3. Create an event hub client connection using the following code:
eventHubClient = EventHubClient.CreateFromConnectionString(AzureIoTHub.GetConnectionString(), iotHubD2cEndpoint);
  1. Scan through all partitions of the event hub:
var d2cPartitions = eventHubClient.GetRuntimeInformation().PartitionIds;String data = "";foreach (string partition in d2cPartitions){ var result = ReceiveMessagesFromDeviceAsync(partition); data = result.Result.ToString(); if (data != "") return data;}return data;
  1. lets use following ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Azure Serverless Computing Cookbook - Third Edition

Azure Serverless Computing Cookbook - Third Edition

Praveen Kumar Sreeram, Kasam Shaikh, Greg Leonardo

Publisher Resources

ISBN: 9781787283008Supplemental Content