Azure Messaging and Integration
Queues, events and workflows inside Azure
Service Bus, Event Grid, Event Hubs, Logic Apps and Azure Functions glue services together. Queues smooth load; event buses fan out; streams feed analytics.
What you will learn
- Choose between Service Bus, Event Grid and Event Hubs
- Design async flows with queues
- Orchestrate workflows with Logic Apps / Functions
Service Bus is a broker for ordered reliable messaging; Event Grid delivers events to subscribers with retries; Event Hubs is a high-throughput streaming platform; Functions + Logic Apps run and orchestrate serverless work.
What is this?
Service Bus is an enterprise message broker (queues, topics/subscriptions with rules) for command-style messaging with ordering and transactions. Event Grid is a serverless event router: events (blob created, VM deallocated) fan out to subscribers (Functions, webhooks, namespaces) with built-in retry. Event Hubs is a streaming ingest platform (like Kafka) for large telemetry volumes. Logic Apps is a low-code workflow orchestrator (connectors to hundreds of services); Azure Functions is code-based serverless for the same integration role.
Why do you need it?
- Decoupling with queues absorbs bursts and keeps slow consumers from breaking fast producers.
- Event Grid makes reactive automation trivial: 'when X publishes, do Y' without polling.
- Event Hubs handles the big telemetry firehose that queues would drown in.
- Logic Apps reuses connectors so integration flows ship without writing glue code.
Mental model
A mailroom, a noticeboard, and a firehose
Service Bus, Event Grid, Event Hubs
The mailroom (Service Bus) delivers ordered parcels to named addresses with acknowledgement. The noticeboard (Event Grid) posts a notice and anyone subscribed reacts. The firehose (Event Hubs) sprays thousands of events a second toward analytics collectors.
How it works
- Service Bus: send message → queue/topic → consumer receives (with lock/peek), DLQ for poison messages.
- Event Grid: publisher emits event → topic/domain → subscriptions filter & deliver with exponential retry.
- Event Hubs: producers write events to a partition; consumers read from offset; checkpoints persist position.
- Functions bind natively to queues/blobs/events; Logic Apps orchestrates with connectors.
- Both support dead-lettering, batching and idempotency guidance.
Picking the integration primitive.
In production
- An order flow writes to Service Bus; a worker picks and processes each order, dead-lettering failures.
- Blob-created events via Event Grid trigger a Functions transcoder and a ticketing webhook.
- Telemetry from 100k devices flows through Event Hubs into Stream Analytics and then blob storage.
Best practices
- Prefer async handoffs via Service Bus over synchronous HTTP between services.
- Set up dead-lettering from day one; unhandled messages shouldn't silently vanish.
- Make consumers idempotent — once-only delivery isn't guaranteed.
- Put a backoff policy on Event Grid subscriptions to absorb downstream slowness.
Common mistakes
- Using Event Hubs for order processing — ordering within partitions yes, but it's a stream not a transactional broker.
- Ignoring DLQ, so a poison message 'reappears' forever retrying.
- Synchronous fan-out via HTTP to many services — one slow subscriber blocks the rest.
- No idempotency keys: retries double-counts.
Common issues
Message stuck in queue with delivery count soaringConsumer processing fails and abandons repeatedly
Move to dead-letter, inspect the message, fix the handler, replay.
Event Grid webhook gets 429Subscriber throttling/down
Add a function consumer with retry, or raise webhook robustness (201 handshake).
Event Hubs consumer lags hoursToo few consumers/partitions or a slow transform
Add consumers, checkpoint more often, and batch the transform.
Debugging tips
- Message 'lost'? Check queue Deep structures, DLQ and the lock/abandon count.
- Event Grid not firing? Inspect delivery history and dead-letter destination in the subscription.
- Consumer slow? Look for partition skew in Event Hubs and checkpoints being rewritten.
- For slow Logic Apps, read the run history step durations.
Interview checkpoint
Quick quiz
Which service suits a high-volume telemetry stream for later replay?