Exam AI-200 Topic 1 Question 2 Discussion
Actual exam question for Microsoft's AI-200 exam
Question #: 2
Topic #: 1
Question #: 2
Topic #: 1
Hotspot Question
You are reviewing the message-processing code in a backend worker service.
You review the following Python code that initializes and starts a Service Bus processor.

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.

You are reviewing the message-processing code in a backend worker service.
You review the following Python code that initializes and starts a Service Bus processor.

For each of the following statements, select Yes if the statement is true. Otherwise, select No.
NOTE: Each correct selection is worth one point.

Suggested Answer:

Explanation:
Box 1: No
No, messages are not removed from the queue as soon as they are received when using PEEK_LOCK mode.
How PEEK_LOCK Works
The Lock: The Service Bus processor locks the message exclusively for your worker for a specific duration.
The Invisible State: Other workers cannot see or process the message while the lock is active.
The Removal: The message is only permanently removed from the queue after it is successfully processed and explicitly completed.
Box 2: Yes
Yes, the message can be retried by another consumer if it fails due to a TransientServiceError.
Explicit abandonment: The code calls receiver.abandon_message(msg) when catching a TransientServiceError.
Lock release: Abandoning a message immediately releases the PEEK_LOCK held by the current worker.
Immediate availability: The message returns to the active queue and becomes instantly visible to other competing consumers.
Box 3: No
No, messages with invalid JSON payloads will not be retried until the maximum delivery count is reached. They will be sent to the dead-letter queue (DLQ) immediately on the very first attempt.
Immediate Dead-Lettering: The code catches the json.JSONDecodeError and explicitly calls receiver.dead_letter_message(msg).
Instant Termination: This API call tells Azure Service Bus to move the message to the DLQ right away, bypassing the normal delivery count logic.
No Re-delivery: Because the message is moved to the DLQ, the broker removes it from the main queue, stopping any further processing attempts.
Reference:
https://learn.microsoft.com/en-us/python/api/azure-servicebus/azure.servicebus.aio.servicebusreceiver
https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-python-how-to-use-queues
by Kim at Aug 01, 2026, 02:12 AM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).