Microsoft Certified: Azure Developer Associate (AZ-204)Connect to and consume Azure services and third-party servicesMedium
A company is building an e-commerce platform where customer orders need to be processed by a series of independent microservices. Each order should be processed exactly once, and the order of processing is critical for certain steps. If a microservice fails, the message should be redelivered. Which Azure Service Bus feature ensures reliable, ordered, and exactly-once processing for this scenario?
- AAuto-delete on idle
- BMessage deferral
- CSession-enabled queues/subscriptions
- DDead-lettering
Show answer & explanationAnswer & explanation
Correct answer: C. Session-enabled queues/subscriptions
Azure Service Bus sessions provide guaranteed ordered delivery and exactly-once processing for messages belonging to a session. This is crucial for scenarios where message order is important, such as processing customer orders, and ensures that all messages for a specific session are handled by the same receiver.
Why the other options are wrong
- A. Auto-delete on idle automatically removes inactive queues/subscriptions, not related to message order or exactly-once processing.
- B. Message deferral allows a receiver to temporarily hide a message from the queue, but doesn't inherently guarantee order or exactly-once processing across a series of messages.
- D. Dead-lettering moves messages that cannot be processed to a special queue, which aids reliability but doesn't guarantee order or exactly-once processing for the main flow.
Azure Service Bus Sessions
A feature of Azure Service Bus queues and subscriptions that provides guaranteed ordered delivery and exactly-once processing of related messages.
- Ensures all messages with the same SessionId are processed sequentially.
- Messages within a session are handled by a single receiver.
- Crucial for scenarios requiring message order (e.g., order processing).
Memory trick: Service Bus has 'superpowers' for tricky message flows.