Services hosted on Azure cater to diverse modes of connectivity and communication which helps you to connect your data to power of cloud. While both IoT Hub and Event Hubs can ingest humongous datasets to process and store them for business insights with low latency and high reliability, they are designed for different use cases. IoT Hub was meant to address the need for communication among IoT devices and Azure while Event Hub was designed for big data streaming.
Customers may have business requirements to use both IoT Hubs and Event Hub in a Solution Architecture, and you may need to route the messages from IoT Hub to an Event Hub. Routing serves two purposes: Sending Device Telemetry as well as event data and filtering the data to various endpoints.
In this article, we will learn to route the messages from IoT Hub to an vent Hub. The assumption here is that an IoT Hub is already in place to receive Simulated data. I will create an Event Hub and perform message routing.
Let’s see how to route the messages from IoT Hub to an Event Hub
Create an Event Hub
- Go to Event Hub. Click on Add
- Enter details and click on Create
Create Event Hub Endpoint
- Go to IoT Hub Dashboard
- Click on Message Routing
- Click on Custom endpoints
- Click on Add > Event hubs
- Provide Endpoint name and select the Event hub instance. Click on Create
Create Routing to Event Hub
- Click on Routes > Add
- Provide Route name and Select Endpoint created in previous step. Click on Save
We can filter out the messages before routing the data to endpoint by creating a query. In this article, we shall skip this step.
- To verify the routing, go to Event hub
- Click on Activity log
We have successfully routes messages from IoT Hub to Event Hub. Now, you can use Azure Functions and Stream Analytics to process the messages from Event hub and store in various storage accounts.