Azure
Intermediate 14 min read Azure

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.

Service BusEvent GridEvent HubsLogic AppsFunctionsintegration
Before we start

What you will learn

  • Choose between Service Bus, Event Grid and Event Hubs
  • Design async flows with queues
  • Orchestrate workflows with Logic Apps / Functions
In 60 seconds

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.

Introduction

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.

Motivation

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.
Think about it

Mental model

Imagine

A mailroom, a noticeboard, and a firehose

Think of

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.

Mechanics

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.

Command / ordered work
Events / reactive triggers
High-volume streams
Workflow orchestration
Subscribers
Real world

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.
Guidelines

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.
Watch out

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.
Root cause analysis

Common issues

Error
Message stuck in queue with delivery count soaring
Root cause

Consumer processing fails and abandons repeatedly

Fix

Move to dead-letter, inspect the message, fix the handler, replay.

Error
Event Grid webhook gets 429
Root cause

Subscriber throttling/down

Fix

Add a function consumer with retry, or raise webhook robustness (201 handshake).

Error
Event Hubs consumer lags hours
Root cause

Too few consumers/partitions or a slow transform

Fix

Add consumers, checkpoint more often, and batch the transform.

When things break

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.
Interviews

Interview checkpoint

Test yourself

Quick quiz

0/1
1

Which service suits a high-volume telemetry stream for later replay?

Go deeper

Official documentation