Message processing in an IoT solution
This overview introduces the key concepts around processing messages sent from your devices in a typical Azure IoT solution. Each section includes links to content that provides further detail and guidance.
The following diagram shows a high-level view of the components in a typical IoT solution. This article focuses on the message processing components of an IoT solution.
In Azure IoT, message processing refers to processes such as routing and enriching telemetry messages sent by devices. These processes are used to control the flow of messages through the IoT solution and to add additional information to the messages.
Route messages
An IoT hub provides a cloud entry point for the telemetry messages that your devices send. In a typical IoT solution, these messages are delivered to other downstream services for storage or analysis.
IoT Hub routing
In IoT hub, you can configure routing to deliver telemetry messages to the destinations of your choice. Destinations include:
- Storage containers
- Service Bus queues
- Service Bus topics
- Event Hubs
Every IoT hub has a default destination called the built-in endpoint. Downstream services can connect to the built-in endpoint to receive messages from the IoT hub.
To learn more, see Use IoT Hub message routing to send device-to-cloud messages to different endpoints.
You can use queries to filter the messages sent to different destinations.
IoT Central routing
If you're using IoT Central, you can use data export to send telemetry messages to other downstream services. Destinations include:
- Storage containers
- Service Bus queues
- Service Bus topics
- Event Hubs
- Azure Data Explorer
- Webhooks
An IoT Central data export configuration lets you filter the messages sent to a destination.
To learn more, see Export data from IoT Central.
Event Grid
IoT Hub has built-in integration with Azure Event Grid. An IoT hub can publish an event whenever it receives a telemetry message from a device. You can use Event Grid to route these events to other services.
To learn more, see React to IoT Hub events by using Event Grid to trigger actions and Compare message routing and Event Grid for IoT Hub.
Enrich or transform messages
To simplify downstream processing, you might want to add data to telemetry messages or modify their structure.
IoT Hub message enrichments
IoT Hub message enrichments let you add data to the messages sent by your devices. You can add:
- A static string
- The name of the IoT hub processing the message
- Information from the device twin
To learn more, see Message enrichments for device-to-cloud IoT Hub messages.
IoT Central message transformations
IoT Central has two options for transforming telemetry messages:
- Use mappings to transform complex device telemetry into structured data on ingress to IoT Central.
- Use transformations to manipulate the format and structure of the device data before you export it to a destination.
Process messages at the edge
An Azure IoT Edge module can process telemetry from an attached sensor or device before it sends it to an IoT hub. For example, before it sends data to the cloud an IoT Edge module can:
- Filter data
- Aggregate data
- Convert data
Other cloud services
You can use other Azure services to process telemetry messages from your devices. Both IoT Hub and IoT Central can route messages to other services. For example, you can forward telemetry messages to:
Azure Stream Analytics is a managed stream processing engine that is designed to analyze and process large volumes of streaming data. Stream Analytics can identify patterns in your data and then trigger actions such as creating alerts, sending information to a reporting tool, or storing the transformed data. Stream Analytics is also available on the Azure IoT Edge runtime, enabling it to process data at the edge rather than in the cloud.
Azure Functions is a serverless compute service that lets you run code in response to events. You can use Azure Functions to process telemetry messages from your devices.
To learn more, see:
- Azure IoT Hub bindings for Azure Functions
- Visualize real-time sensor data from Azure IoT Hub using Power BI
- Extend Azure IoT Central with custom rules using Stream Analytics, Azure Functions, and SendGrid
Next steps
Now that you've seen an overview of device management and control in Azure IoT solutions, some suggested next steps include: