AZ-204 Practice Question: Connect to and consume Azure services and third-party services
Your application uses Azure Service Bus topics. You need to ensure that messages are processed in the order they were sent within a session. What must you configure?
⚠ Common exam trap
Many exam-takers confuse duplicate detection (MessageId) with session-based ordering (SessionId), or assume partitioning (which improves throughput) also guarantees order, when in fact it can break ordering across partitions.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Enable sessions on the topic and set the SessionId property on messages.
Azure Service Bus sessions provide strict message ordering and exactly-once processing within a session. By enabling sessions on the topic and setting the SessionId property on each message, all messages with the same SessionId are processed in FIFO order, ensuring they are received in the exact sequence they were sent.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Enable duplicate detection.
Why it's wrong here
Enabling duplicate detection on an Azure Service Bus topic prevents the same message from being processed multiple times within a configurable time window, typically 10 minutes. It relies on the MessageId property to identify duplicates. While this feature ensures idempotency and reliability against transient network issues or retries, it does not reorder messages or guarantee that messages from a specific sender or related set of operations will be delivered in the sequence they were originally sent.
- ✗
Enable partitioning on the topic.
Why it's wrong here
Enabling partitioning on an Azure Service Bus topic distributes messages across multiple internal message brokers or message stores, which significantly increases the overall throughput and availability of the topic. However, messages sent to a partitioned topic are not guaranteed to be processed in any specific order across these independent partitions. This feature is primarily designed for scaling the message system's capacity, not for maintaining message sequence or ensuring FIFO delivery.
- ✓
Enable sessions on the topic and set the SessionId property on messages.
Why this is correct
Enabling sessions on an Azure Service Bus topic and subsequently setting the SessionId property on messages is the correct mechanism to ensure ordered delivery and processing of related messages. When sessions are active, all messages sharing the same SessionId are guaranteed to be delivered to a single receiver in the exact First-In, First-Out (FIFO) order in which they were sent. This is essential for scenarios requiring sequential processing of a message stream, such as processing a series of steps for a single customer order.
- ✗
Set the MessageId property to a GUID.
Why it's wrong here
Setting the MessageId property to a GUID primarily serves to uniquely identify a message within an Azure Service Bus queue or topic. This unique identifier is crucial when duplicate detection is enabled, as Service Bus uses the MessageId to identify and discard messages that have already been received within the configured detection window. However, the MessageId property itself does not influence the order in which messages are delivered or processed; it is an identifier, not an ordering mechanism.
Go deeper
Related to this question
Learn chapter
Azure Functions Development
Key term
Azure Relay
Azure Relay is a cloud service that securely exposes on-premises web services to the public internet or other cloud applications without opening firewall ports.
Key term
Azure Service Bus
Azure Service Bus is a cloud-based message broker that allows applications, services, and devices to send and receive messages reliably, even when they are not all running at the same time.
About these practice questions
One of 881 original AZ-204 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. Learn why practice questions differ from exam dumps →
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This AZ-204 practice question is part of Courseiva's free Microsoft certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the AZ-204 exam.