Azure Service Bus Topics
What you'll learn: How to create Service Bus topics with subscriptions and rules that route and filter messages to multiple receivers.
Core Concept
Azure Service Bus Topics extend beyond simple queues by enabling publish-subscribe messaging. Instead of one sender to one receiver, topics allow one sender to broadcast messages to multiple subscribers, each with their own subscription. Each subscription acts like a virtual queue that receives copies of messages matching its filters.
Think of topics like a newspaper publisher: the publisher (sender) prints one edition, but multiple subscribers receive their own copy. Some subscribers might only want sports news, others want business—subscription rules make this filtering possible.
How Topics Work
When you create a Service Bus topic, you define:
- Topic: The message destination where publishers send
- Subscriptions: Named endpoints that receive message copies
- Rules/Filters: Criteria that determine which messages each subscription receives
Message Routing with Filters
Each subscription can have rules with three filter types:
- SQL Filters: Match messages based on properties (e.g.,
Category = 'Order') - Correlation Filters: Fast, optimized property matching
- Boolean Filters: Accept all (
TrueFilter) or none (FalseFilter)
Without filters, subscriptions receive all messages from the topic.
Common Pattern
A single order processing system might publish order messages to a topic. Three subscriptions could exist:
- Shipping subscription (filter:
Status = 'Approved') - Inventory subscription (filter:
Type = 'Physical') - Analytics subscription (no filter—receives everything)
Each team processes only relevant messages independently.
Key Takeaway: Azure Service Bus Topics enable flexible, multi-subscriber message distribution with powerful filtering rules that route messages based on properties, allowing different services to consume only what they need from a single publishing source.