Microsoft Certified: Azure Developer Associate (AZ-204)Develop for Azure storageMedium
A manufacturing plant uses Azure Queue Storage to process messages from factory sensors. Currently, a single worker role processes these messages. A new requirement dictates that if a message fails to process due to a transient error, it should automatically become visible again after a short delay for retry, without immediately going back to the front of the queue, potentially blocking other messages. Which Queue Storage property should the developer configure to achieve this behavior?
- APop Receipt
- BVisibility Timeout
- CDequeue Count
- DMessage TTL (Time to Live)
Show answer & explanationAnswer & explanation
Correct answer: B. Visibility Timeout
The visibility timeout determines how long a message remains invisible after being dequeued. Setting an appropriate visibility timeout allows for retries after a delay if processing fails, preventing the message from being immediately re-processed by the same or another worker.
Why the other options are wrong
- A. Pop Receipt is a token required to delete a dequeued message, not a configuration for message visibility after a transient error.
- C. Dequeue Count indicates how many times a message has been dequeued, useful for dead-lettering, but not for controlling visibility directly.
- D. Message TTL defines how long a message can remain in the queue before expiring, not related to retry logic after dequeue.
Azure Queue Visibility Timeout
The visibility timeout in Azure Queue Storage specifies the duration during which a dequeued message is invisible to other consumers. This allows a consumer to process the message without interference and ensures that if processing fails, the message reappears for retry after the timeout expires.
- Set when a message is dequeued (Pop operation).
- Hides the message from other consumers.
- If processing fails, message becomes visible again after timeout.
- Can be updated dynamically while processing a message.
Memory trick: Put it, Pop it (hide it), Process it, Delete it (or it reappears).