Microsoft Certified: Azure Developer Associate (AZ-204)Connect to and consume Azure services and third-party servicesMedium

A development team is building a new e-commerce platform. They need to implement a mechanism for processing customer orders that ensures messages are delivered in the order they were sent for a specific customer, even if multiple instances of the processing logic are running. The solution must also guarantee that a message is processed completely by only one receiver at a time. Which Azure Service Bus feature should the team use?

  1. AQueues with sessions
  2. BEvent Hubs with consumer groups
  3. CRelays with hybrid connections
  4. DTopics with subscriptions
Show answer & explanation

Correct answer: A. Queues with sessions

Azure Service Bus Queues with sessions provide both ordered delivery for a specific customer (session) and exclusive processing by one receiver (PeekLock behavior, which is default for queues). Topics are for one-to-many, Relays are for hybrid connectivity, and Event Hubs are for high-throughput event ingestion, none of which directly address ordered processing per customer with single-receiver guarantees.

Why the other options are wrong

  • B. Event Hubs are designed for high-throughput event ingestion and do not inherently guarantee ordered processing of messages for a specific entity across multiple consumers.
  • C. Service Bus Relays are used for exposing services running in a corporate network to the public cloud, not for ordered message processing.
  • D. Topics enable one-to-many messaging but do not guarantee ordered processing for specific groups of messages or exclusive processing by a single receiver instance.

Azure Service Bus Sessions

Azure Service Bus sessions enable co-ordered handling of unbounded sequences of related messages. They provide a way for messages to be grouped and processed in order by a single receiver.

  • Guarantees ordered delivery of messages within a session.
  • Ensures exclusive processing of a session by a single receiver.
  • Messages are grouped by a 'SessionId' property.
  • Useful for scenarios requiring stateful message processing.

Memory trick: Ordered items in a box, handled exclusively by one person.

More Connect to and consume Azure services and third-party services questions