AZ-204 Develop Azure compute solutions Practice Question
You have an Azure Function app that uses a Service Bus queue trigger. The function processes messages, but sometimes it takes longer than 5 minutes to process a single message. You notice that the message is processed multiple times. What is the most likely cause?
⚠ Common exam trap
Many candidates confuse the function's timeout setting (which terminates the function) with the Service Bus lock duration (which controls message visibility), leading them to incorrectly select option A.
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
✓
The lock duration on the queue is shorter than the processing time
The most likely cause is that the lock duration on the Service Bus queue is shorter than the time required to process the message. When the lock expires, the message becomes visible to other consumers (or the same consumer on retry), causing it to be processed multiple times. The default lock duration for a Service Bus queue is 30 seconds, and if processing exceeds that, the message will be re-delivered.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
The function's timeout is set to 5 minutes
Why it's wrong here
The function's timeout defines the maximum execution time for a single function invocation. While a function timeout can lead to a message not being completed and subsequently being re-delivered, it does not directly cause the Service Bus message lock to expire before the function finishes its processing. The lock duration is a property of the Service Bus queue itself, managed by the Service Bus service, and operates independently of the function's execution time limit. If the function times out, the message lock might still be active for a period, or it might expire shortly after, leading to re-delivery, but the timeout itself isn't the primary cause of the lock being shorter than the processing time.
- ✓
The lock duration on the queue is shorter than the processing time
Why this is correct
When the lock duration configured on the Service Bus queue is shorter than the actual time required for the Azure Function to fully process a message, the message's lock will expire prematurely. Upon expiration, the Service Bus makes the message available again to other consumers, even if the original function instance is still actively working on it. This scenario directly leads to duplicate processing, as another function instance or consumer can pick up and process the same message while the first attempt is still underway, resulting in redundant operations.
- ✗
The maxDeliveryCount is set too high
Why it's wrong here
The maxDeliveryCount property on a Service Bus queue dictates the maximum number of times a message can be delivered to consumers before it is automatically moved to the dead-letter queue. A high maxDeliveryCount allows for more retries of a message that has failed processing (e.g., due to an exception or an expired lock leading to re-delivery). However, it does not inherently cause duplicate processing where two or more consumers simultaneously process the same message due to a lock expiring mid-processing. It manages the lifecycle of repeatedly failing messages, not the concurrency issue of a premature lock release.
- ✗
The queue has sessions enabled
Why it's wrong here
Service Bus sessions are designed to ensure ordered processing of related messages by guaranteeing that all messages belonging to a specific session are processed by the same receiver. When a receiver accepts a session, it obtains an exclusive lock on that session, preventing other receivers from processing messages within it. Therefore, enabling sessions would actually prevent concurrent processing of messages within the same session, thereby reducing the likelihood of certain types of duplicate processing, rather than causing it.
Go deeper
Related to this question
About these practice questions
Courseiva writes every AZ-204 question from scratch — 881 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. 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.