Service bus, Event hub, IoT hub and event grids.
Before we look into the use cases lets look at the underlying technologies.
The process generally follows the sequence:
event publisher ---> event ingestor ---> event consumer
The data sent from service to service is either an evnt or a message. The event or message is then sent to a queue technology or a stream technology.
Event vs Messages
Event publisher:
- no expectation of how the consumer will action the notification
- discrete notification
- sequenced series of notifications
Message publisher:
- expectation of how the consumer will action the instruction
- instruction to "do something"
In summary, a message is sent to an agent that the sender expects a specific behavior. The sender orchestrates instructions. An event is sent to (normally) because it was requested by the subscriber. The sender has no idea why the subscriber wants it.
Queue vs Stream
Queue
- delivers to one consumer
- once delivered the message is lost
Stream
- delivers to all registered subscribers
- records messages to a distributed log file enabling consumers to scan through the log for old messages. this provides the ability for a subscriber to process messages at any point in (recorded) time
Service Bus - Data pipeline
- data pipeline
- traditional enterprise use
- transactions, ordering, duplicate detection
- brokered messaging system - stores messages reliably until requested
- polling pull model
Event Hub - Data pipeline
High throughput of series events - events with data and possibly a stream of events - handles data and the event.
e.g. logging away millions of telemetry messages (event and data)
- data pipeline
- event ingestor
- distributed stream processing platform
- data streams or bundled events
- realtime processing
- at least once delivery
- millions events per second
- low latency
- push model
- delivered in order (by partition - distributed log file stores sequence)
Event Grid - Router
Dealing wth discrete events in a pubsub model
e.g. reacting to events as part of a control flow like notifying subscribers of a shipped
status
- basically a "router"
- pubsub
- push model
- at least once delivery
- low cost
- dynamically scalable
- deeply integrated into Azure but can service both Azure and non Azure resources
- IS NOT a data pipeline
General purpose of use
Service | Purpose | Type | When to use |
---|---|---|---|
Event Grid | Reactive programming | Event distribution (discrete) | React to status changes |
Event Hubs | Big data pipeline | Event streaming (series) | Telemetry and distributed data streaming |
Service Bus | High-value enterprise messaging | Message | Order processing and financial transactions |
What are the relationships and main differences between event hub, IoT hub and event grid?
Event Hub can accept millions of events per second from devices.
Backend services can feed directly from an Event Hub.
IoT Hub is the same as Event Hub but can also communicate back to the calling device
Event Grid is a store for services to feed from.
This diagram depicts these main differences:
IoT devices can send events to an IoT hub
and Event hub
.
The IoT hub
can send events back to the caller where an Event hub
cant.
The IoT hub
then sends the events on to an Event grid
. This acts as a store and feeds the Backend services
.
An Event hub
can speak directly to the Backend services
where an IoT hub
cannot.