Share via

IoT Hub Queue single client

2022-07-27T09:40:42.927+00:00

Hi,
I have two devices on my IoT Hub , they are sending data to a queue, using service bus and stream analytics job.

Using the Python SDK and the example - Receive messages from a queue, i can see all the messages arriving from the IoT Hub with no problem.

My question is :

Is there a mode to read in the example, the messages from only one device and not from the other ( point to point communication )?

So read the messages from only one device.

My main final project, is to receive the data on an android app from a single device connected to the IoT Hub.

Thanks.

Azure IoT Hub
Azure IoT Hub

An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.


Answer accepted by question author

Sander van de Velde | MVP 37,066 Reputation points MVP
2022-07-27T19:44:12.337+00:00

Hello @SDK for Embedded C IoT Hub Samples on Windows ,

you want to give certain users access to certain devices.

This means you have to have a mapping at some point between a user and a device.

So, if an IoT message arrives, you want to execute some logic that makes the decision on what to do with that message (eg. sending the message to a certain Websocket/SignalR client/etc.).

There are a number of ways to do this (it also depends on how you communicate with devices) but here are a number of ways to do this:

  1. just create a database table (eg. in CosmosDB or SqlAzure) or Azure Storage Table and check this every time a message arrives
  2. Use a Stream Analytics Job and join the mapping as reference data and output to the logic which sends the data
  3. Make use of a tag in the Azure IoT device twin and enrich incoming messages with that tag while routing to the logic (eg. an Azure function having the IoT Hub trigger)

These first two need more Azure resources but managing the tables is much more easy.

The third solution is simple but you need to have knowledge about the Device Twin and how to manipulate it.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.