A company is developing a new order processing system. They need to ensure that when a customer places an order, a message is sent to a messaging service, and this message is then delivered to multiple independent microservices (e.g., Inventory, Shipping, CRM) that need to react to the 'OrderPlaced' event. Each microservice should receive its own copy of the message. Which Azure Service Bus feature should the company use?
- ARelays
- BQueues
- CTopics with Subscriptions
- DEvent Grid
Show answer & explanationAnswer & explanation
Correct answer: C. Topics with Subscriptions
Azure Service Bus Topics with Subscriptions implement a publish-subscribe model, allowing a single message to be published to a topic and then delivered to multiple independent subscribers (microservices in this case), each receiving its own copy. Queues are for point-to-point, Relays are for hybrid connectivity, and Event Grid is a general event routing service but Service Bus Topics are specifically for message-based publish-subscribe.
Why the other options are wrong
- A. Azure Service Bus Relays are used to securely expose services running in a corporate network to the public cloud, not for publish-subscribe messaging.
- B. Azure Service Bus Queues are used for point-to-point messaging, where a message is processed by only one receiver, which does not meet the requirement for multiple independent microservices receiving a copy.
- D. Azure Event Grid is an event routing service that supports publish-subscribe, but for message-based scenarios with features like transactions and advanced queuing, Service Bus Topics are often preferred.
Azure Service Bus Topics
Azure Service Bus Topics provide a publish-subscribe messaging model, enabling one-to-many communication. Publishers send messages to a topic, and multiple independent subscribers can receive copies of these messages via subscriptions.
- Implements publish-subscribe pattern.
- Allows multiple consumers to receive the same message.
- Each subscription gets its own copy of published messages.
- Supports filtering rules for subscriptions.
Memory trick: A speaker (Topic) announces to many listeners (Subscriptions).