Azure Service Bus icon Azure Event Grid icon Azure Event Hubs icon

Messaging & events

Service Bus, Event Grid & Event Hubs

The messaging backbone of Azure Integration Services. Rule of thumb: Service Bus for messages (commands, transactions, ordering), Event Grid for discrete events (reactive pub/sub), Event Hubs for event streams (telemetry firehose).

Which one when?

Service BusEvent GridEvent Hubs
Payload semanticsMessage = intent/command ("process this order")Event = fact ("blob was created")Stream of events (millions/sec telemetry)
Consumer modelCompeting consumers, pull, peek-lockPush to subscribers (webhooks, Functions, queues) + pull; MQTTPartitioned consumer groups, offset replay
Key featuresQueues, topics/subscriptions, sessions (FIFO), transactions, dead-letter, scheduling, dedup, large messages (Premium)Filtering/routing, CloudEvents schema, retry with dead-letter, system events from 30+ Azure services, MQTT broker for IoTKafka-compatible endpoint, capture to storage, retention/replay, Schema Registry
Typical consumersFunctions, Logic Apps, Container Apps workersFunctions, Logic Apps, webhooks, Service BusStream Analytics, Fabric/Databricks, Functions

Service Bus in depth

flowchart LR
    P[Producers] -->|send| T[Topic: orders]
    T --> S1["Subscription: billing
filter: amount > 0"] T --> S2["Subscription: shipping
filter: physical = true"] T --> S3[Subscription: audit
no filter] S1 --> C1[Billing worker
peek-lock · complete/abandon] S2 --> C2[Shipping worker] S3 --> C3[Audit store] C1 -.max deliveries exceeded.-> DLQ[(Dead-letter queue)]
Topics fan out with per-subscription SQL filters; peek-lock + dead-lettering give at-least-once processing with a safety net.

Event Grid in depth

flowchart LR
    subgraph Sources
        SRC1[Azure services
Blob · ACR · Key Vault · APIM] SRC2[Custom apps
CloudEvents] SRC3[MQTT devices
IoT fleet] end EG[Event Grid
topics · namespaces · filters] subgraph Handlers H1[Functions] H2[Logic Apps] H3[Service Bus queue] H4[Webhooks / partner] end SRC1 --> EG SRC2 --> EG SRC3 --> EG EG -->|subject/type filters| H1 EG --> H2 EG --> H3 EG --> H4
Discrete-event router: filtered push (or pull) delivery with retries and dead-lettering; MQTT broker capability brings device fleets into the same fabric.

Event Hubs in depth

Detailed use cases

Use case

Order processing backbone

API accepts order → Service Bus topic → billing/shipping/audit subscriptions process independently. Sessions keep per-order FIFO; DLQ isolates poison messages.

Use case

Load leveling

Spiky front-end traffic lands in a queue; fixed-size workers drain at sustainable rate — the database never melts.

Use case

Reactive automation

Blob created → Event Grid → Function generates thumbnail; Key Vault secret near expiry → Event Grid → Logic App rotates and notifies.

Use case

IoT command & telemetry

MQTT devices publish to Event Grid namespaces; routing sends alerts to Service Bus for guaranteed handling and streams bulk telemetry to Event Hubs.

Use case

Clickstream analytics

Web/app events → Event Hubs → Stream Analytics for real-time dashboards + Capture to data lake for ML training sets.

Use case

Cross-service saga

Services exchange events via topics; compensating handlers undo committed steps when a downstream step fails — no distributed transactions needed.

Patterns cheat sheet