Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ramandeep-singh-1983/093803ec4b6bff3dcbbeed1363f5a86a to your computer and use it in GitHub Desktop.
Save ramandeep-singh-1983/093803ec4b6bff3dcbbeed1363f5a86a to your computer and use it in GitHub Desktop.
Criteria Event Grid IoT Hub Message Routing Event Hub Service Bus Topics
Event delivery mechanism (Push/Pull) Push Push Pull Pull
Supported sources Life-cycle events Life-cycle events Life-cycle events Life-cycle events
Telemetry Telemetry Telemetry Telemetry
Device twin change events Device twin change events Device twin change events
Digital twin change events Digital twin change events Digital twin change events
Supported targets Webhooks Event hubs Acts as an event sink and requires consumers to pull data from it. SDKs in various languages are provided for the same. Acts as a queue and requires consumers to pull data from it. SDKs in various languages are provided for the same.
Storage queues Service bus queues
Event hubs Service bus topics
Hybrid connections (Enterprise WebSocket) Storage containers
Service bus queues
Reliability 24-hour retry with exponential back-off to make sure events are delivered. High: Delivers each message to the endpoint at least once for each route. Expires all messages that are not delivered within one hour. At least once delivery at scale. Reliable asynchronous message delivery that requires polling.
Delivers each message to the WebHook at least once for each subscription. Expires all events that are not delivered within 24 hours. At least once delivery.
Scalability Serverless and dynamically scalable. High scalability High scalability. Scalable but quotas are defined here
Performance improvement information is here
Ordering of events Not guaranteed. Ordering of events is maintained. Ordering of events is maintained. Optional in-order delivery.
Use cases Suitable for discrete events Suitable for streaming data as well as discrete events. Suitable for streaming data. Suitable for enterprise messaging, transactional data.
Best suited for processing independent events in parallel. Suitable for reading events but requires polling.
Other features/caveats 3rd party services can register webhooks and event grid will deliver the events to registered webhooks. No polling is required in this case. IoT Hub message routing is a message broker and doesn't act as a final destination for reading events or messages. Event Hub is a highly scalable message broker and event sink from where consumers can pull out the relevant data. Advanced messaging features like FIFO, batching/sessions, transactions, dead-lettering, temporal control, routing and filtering, and duplicate detection.
Event Grid is significantly more scalable than Service Bus, supporting up to 10,000,000 events per second in a single Azure region. To achieve this, Event Grid might deliver events out of order, while Service Bus guarantees in-order message delivery. The purpose of message routing is to forward the event/message to appropriate handler based on the defined routing rules or queries. Event Hub works well for events as well as messages. Service Bus topics work with messages, not events. They let receivers decide when to read a message, and they require the receiver to actively poll for new messages.
The Event Grid will wait for, at most, 60 seconds for an event to be positively acknowledged. If there’s any chance that the processing will take longer, it’s better to turn to the Service Bus pull model that allows for processing to take much longer while maintaining a lock on the message. Event Hub can manage high throughput of incoming events and consumers don't need to build complex logic to handle high throughput of incoming events. Consumers can pull the messages as per their convenience. For long running processing tasks, it’s better to turn to the Service Bus pull model that allows for processing to take much longer while maintaining a lock on the message.
Service Bus is fast, but Event Grid provides near real-time performance, with 99% of events delivered in less than a second.
The WebHook consumer service has to be highly performant and horizontally scalable so that events/notifications are delivered in near real-time and that the delivery is not affected by high throughput of incoming events.
Twin change events are not delivered by IoT hub messaging to Event Grid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment