Messaging & Events
Event Grid · Event Hubs · Service Bus · Storage Queues
Practice questions for this topic →
Pick the service
| Service | Data model | Use when |
|---|---|---|
| Event Grid | Discrete events (push) | React to state changes: blob created, resource events, serverless handlers |
| Event Hubs | Event streams (partitions, consumer groups) | Telemetry, millions of events per second, real-time analytics, Kafka clients |
| Service Bus | High-value messages | Orders, payments, workflows: ordering, transactions, dead-letter, sessions |
| Storage Queues | Simple messages | Cheap background work where losing a message just costs a rerun |
Event vs message: an event is a lightweight notification of a state change and the publisher expects nothing in return. A message carries data under a contract between publisher and consumer.
Service Bus tiers
| Feature | Basic | Standard | Premium |
|---|---|---|---|
| Queues | ✓ | ✓ | ✓ |
| Topics / subscriptions | — | ✓ | ✓ |
| Transactions, duplicate detection, sessions | — | ✓ | ✓ |
| Max message size | 256 KB | 256 KB | 100 MB |
| Resource isolation, Geo-Replication, JMS 2.0 | — | — | ✓ |
Event Hubs tiers
| Tier | Max retention | Capture | Kafka | Notes |
|---|---|---|---|---|
| Basic | 1 day | — | — | One consumer group |
| Standard | 7 days | Billed separately | ✓ | Geo-DR; 40 throughput-unit threshold per namespace |
| Premium | 90 days | Included | ✓ | Resource isolation, customer-managed keys, geo-replication |
| Dedicated | 90 days | Included | ✓ | Single tenant, highest quotas |
Tier can't be changed in place; you deploy a new namespace. Capacity is billed per namespace, so needing more than 40 TUs without a dedicated cluster means a new namespace.
Facts to know
- Service Bus Geo-Replication is Premium-only, copies data and metadata, supports one secondary region, and can't be combined with Geo-Disaster Recovery (metadata only).
- After promoting a Geo-Replication secondary, Event Grid integration stays in the initial primary region; removing that region from the configuration breaks the integration.
- Service Bus duplicate detection works on the application-set MessageId within a time window; it's not available on Basic.
- Storage Queues suit simple, eventual background work; dead-lettering, ordering, duplicate detection and transactions point to Service Bus.
Exam Tips
Tick each tip once you can answer it without looking.
“Trigger processing whenever a blob is uploaded” → Event Grid.
“Ingest millions of telemetry events per second” → Event Hubs.
“Messages must be processed in FIFO order / exactly once” → Service Bus with sessions (Standard or Premium). Trap: Storage Queues and Event Grid don't guarantee ordering.
“Publish once, many subscribers with filters, guaranteed delivery” → Service Bus topics. Trap: Basic tier has no topics.
“Messages larger than 256 KB (up to 100 MB)” → Service Bus Premium.
“Sender retries must not create duplicate messages” → Service Bus duplicate detection (MessageId within a time window). Trap: Not available on Basic.
“Existing Kafka producers must send to Azure with no code changes” → Event Hubs (Standard or higher). Trap: Basic doesn't support Kafka.
“Keep streaming data longer than 7 days” → Event Hubs Capture to Storage/ADLS, or Premium/Dedicated (90 days).
“Service Bus DR must preserve the messages themselves, not just config” → Service Bus Geo-Replication (Premium). Trap: Geo-Disaster Recovery replicates metadata only, and the two can't be combined.
“Simple, cheapest queue for background jobs; no ordering or dead-letter needed” → Storage Queues.
“Service Bus namespace promoted to its geo-replication secondary, with Event Grid integration” → Event Grid keeps running in the initial primary region. Trap: Removing the initial primary region from geo-replication breaks the integration.
“Event Hubs namespace would need more than 40 throughput units without a dedicated cluster” → Create a new namespace with its own capacity. Trap: Tier can't be changed in place.
“Event Hubs tiers that include Capture” → Premium and Dedicated include it; Standard bills it separately; Basic has none. Trap: Premium and Dedicated also keep events up to 90 days.
“Event versus message” → Event: notification of a state change, no expectation of handling. Message: data under a contract between publisher and consumer. Trap: Events fit Event Grid; messages fit Service Bus.