Azure Service Bus is the enterprise messaging backbone. Beyond simple queues, it offers powerful patterns.
Topic Filters (Pub/Sub)
Instead of creating a queue for every variation, create one Topic. Subscribers can filter what they receive using SQL filters.
-- Subscriber 1 (Inventory)
userProperties.Type = 'OrderCreated'
-- Subscriber 2 (Europe Compliance)
userProperties.Region = 'EU' AND userProperties.Value > 1000
Dead Letter Handling
Always handle your Dead Letter Queue (DLQ). Messages go there after max delivery attempts. I assume 99% of DLQ messages are “poison data” (serialization errors, bad schema) and alert on them. Don’t auto-retry DLQ messages without inspection.
Sessions (FIFO)
If order matters (e.g., “Order Created” MUST be processed before “Order Shipped”), use Sessions. The SessionID (e.g. OrderId) guarantees that all messages for that Order are processed in order by the same consumer.
Discover more from C4: Container, Code, Cloud & Context
Subscribe to get the latest posts sent to your email.