Why Service Bus?
In enterprise systems, reliability and guaranteed delivery of messages are critical. Unlike lightweight queues (e.g., Storage Queue), Azure Service Bus provides enterprise-grade messaging with support for transactions, ordering, duplicate detection, and dead-lettering.
It’s the go-to service for business-critical integrations that cannot afford message loss.
1. Service Bus Queues
Definition:
Point-to-point messaging — one producer, one consumer.
Features:
-
FIFO (First In, First Out) ordering.
-
At-least-once delivery.
-
Duplicate detection to avoid reprocessing.
-
Time-to-Live (TTL) per message.
Use Cases:
-
Order processing system.
-
Payment gateway integration.
-
Reliable task queue between services.
2. Service Bus Topics & Subscriptions
Definition:
Publish/subscribe model — one message can be delivered to multiple subscribers.
Features:
-
Subscribers can filter messages with SQL-like filters.
-
Fan-out architecture (1 publisher → many consumers).
-
Supports independent scaling of subscribers.
Use Cases:
-
Event distribution (e.g., customer order → billing, inventory, shipping).
-
Multi-team integration pipelines.
3. Dead-Letter Queue (DLQ)
Definition:
Special sub-queue for messages that cannot be delivered or processed.
Causes:
-
Message TTL expired.
-
Too many delivery attempts (poison messages).
-
Explicit rejection by consumer.
Importance:
-
Prevents message loss.
-
Allows investigation of failed messages.
4. Advanced Features
-
Sessions → group related messages (like conversation ID).
-
Transactions → atomic operations on multiple messages.
-
Deferred Messages → delay processing until consumer is ready.
-
Geo-disaster recovery → namespace failover between regions.
Example Enterprise Scenario
A retail company needs:
-
Reliable order processing (no message loss).
-
Multiple services (billing, warehouse, shipping) reacting to order events.
-
A way to capture failed messages for auditing.
Correct design:
-
Use Service Bus Queue for order ingestion.
-
Use Service Bus Topic with subscriptions for billing/warehouse/shipping.
-
Enable Dead-Letter Queue for poison messages.
Confusion Buster
-
Service Bus vs Storage Queue
-
Service Bus = enterprise-grade, transactions, DLQ.
-
Storage Queue = lightweight, simple, cheaper.
-
-
Topic vs Event Grid
-
Topic = reliable messaging, stateful.
-
Event Grid = event-driven, lightweight, near real-time.
-
-
DLQ vs Retry
-
Retry = transient errors.
-
DLQ = poison or expired messages.
-
Exam Tips
-
“Which service provides FIFO messaging with transactions?” → Service Bus.
-
“Which Service Bus feature allows multiple subscribers?” → Topics.
-
“Which Service Bus feature handles poison messages?” → Dead-Letter Queue.
-
“Which queue is enterprise-grade with ordering and duplicate detection?” → Service Bus Queue.
What to Expect in the Exam
-
Direct Q: “Which Azure service supports publish/subscribe with filtering?” → Service Bus Topics.
-
Scenario Q: “Company must ensure order messages are delivered once, even after retries.” → Service Bus Queue.
-
Scenario Q: “Multiple departments must process the same order event.” → Service Bus Topic with subscriptions.
-
Trick Q: “Storage Queue supports sessions and transactions.” → False (only Service Bus does).