Comparison of Azure IoT Hub and Azure Event Hubs
One of the main use cases for IoT Hub is to gather telemetry from devices. For this reason, IoT Hub is often compared to Azure Event Hubs. Like IoT Hub, Event Hubs is an event processing service that enables event and telemetry ingress to the cloud at massive scale, with low latency and high reliability.
However, the services have many differences, which are detailed in the following table:
|Area||IoT Hub||Event Hubs|
|Communication patterns||Enables device-to-cloud communications (messaging, file uploads, and reported properties) and cloud-to-device communications (direct methods, desired properties, messaging).||Only enables event ingress (usually considered for device-to-cloud scenarios).|
|Device state information||Device twins can store and query device state information.||No device state information can be stored.|
|Device protocol support||Supports MQTT, MQTT over WebSockets, AMQP, AMQP over WebSockets, and HTTPS. Additionally, IoT Hub works with the Azure IoT protocol gateway, a customizable protocol gateway implementation to support custom protocols.||Supports AMQP, AMQP over WebSockets, and HTTPS.|
|Security||Provides per-device identity and revocable access control. See the Security section of the IoT Hub developer guide.||Provides Event Hubs-wide shared access policies, with limited revocation support through publisher's policies. IoT solutions are often required to implement a custom solution to support per-device credentials and anti-spoofing measures.|
|Operations monitoring||Enables IoT solutions to subscribe to a rich set of device identity management and connectivity events such as individual device authentication errors, throttling, and bad format exceptions. These events enable you to quickly identify connectivity problems at the individual device level.||Exposes only aggregate metrics.|
|Scale||Is optimized to support millions of simultaneously connected devices.||Meters the connections as per Azure Event Hubs quotas. On the other hand, Event Hubs enables you to specify the partition for each message sent.|
|Device SDKs||Provides device SDKs for a large variety of platforms and languages, in addition to direct MQTT, AMQP, and HTTPS APIs.||Is supported on .NET, Java, and C, in addition to AMQP and HTTPS send interfaces.|
|File upload||Enables IoT solutions to upload files from devices to the cloud. Includes a file notification endpoint for workflow integration and an operations monitoring category for debugging support.||Not supported.|
|Route messages to multiple endpoints||Up to 10 custom endpoints are supported. Rules determine how messages are routed to custom endpoints. For more information, see Send and receive messages with IoT Hub.||Requires additional code to be written and hosted for message dispatching.|
In summary, even if the only use case is device-to-cloud telemetry ingress, IoT Hub provides a service that is designed for IoT device connectivity. It continues to expand the value propositions for these scenarios with IoT-specific features. Event Hubs is designed for event ingress at a massive scale, both in the context of inter-datacenter and intra-datacenter scenarios.
It is not uncommon to use both IoT Hub and Event Hubs in the same solution. IoT Hub handles the device-to-cloud communication, and Event Hubs handles later-stage event ingress into real-time processing engines.
To learn more about planning your IoT Hub deployment, see Scaling, HA, and DR.
To further explore the capabilities of IoT Hub, see: