Azure IoT Hub Message Routing for Telemetry Data to Azure Cosmos DB | Exam AZ-220 Answer

Azure IoT Hub Message Routing for Telemetry Data

Question

You are building an industrial IoT solution where, using several IoT hubs, you collect telemetry data from a number of field sensors.

The final destination of the data is Azure Cosmos DB and you need to establish a route to forward messages from your IoT hubs.

In addition, each message needs to be stamped with the name of the IoT hub ($iothubname) which it originates from, to enable further classification.

You decide to use IoT hub's message routing.

Does it help you to achieve your goal?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B.

Correct Answer: B.

Option A is incorrect because although, through the Custom endpoint feature, IoT hubs can be linked to several other Azure services as sinks for messages, Cosmos DB is not one of them, so it cannot be targeted directly.

Messages can be routed to Storage Containers and then further to Cosmos DB, for example.

Option B is CORRECT because with IoT hub's routing capability, you can forward incoming messages to other Azure services as Custom endpoints.

CosmosDB is not among the available endpoints, therefore message routing cannot be used for this use case.

References:

The answer is A. Yes, using IoT hub's message routing can help achieve the goal of forwarding messages from IoT hubs to Azure Cosmos DB and stamping each message with the name of the IoT hub it originates from ($iothubname).

IoT hub's message routing is a feature that allows messages from IoT devices to be automatically routed to different endpoints, such as Azure Blob Storage, Azure Event Hubs, and Azure Service Bus. This feature can also be used to route messages to Azure Cosmos DB.

To use IoT hub's message routing to forward messages to Azure Cosmos DB, you would create a custom endpoint for Cosmos DB in the IoT hub's message routing configuration. This custom endpoint would specify the connection string for the Cosmos DB instance and the collection where the data should be stored.

In addition, you can configure IoT hub's message routing to add a custom message property ($iothubname) to each message, which contains the name of the IoT hub that the message originated from. This can be useful for further classification or filtering of messages based on their source.

Overall, using IoT hub's message routing can simplify the process of forwarding telemetry data from multiple IoT hubs to Azure Cosmos DB, and allow for customization of message properties to aid in further processing and analysis.