Visibility Timeout in Azure Storage Queues
I have asked azure to fix this with some comments on the fields, but since it has been quite a few years, I am not holding my breath.
Azure Storage queues have two completely different concepts both named visibility timeout, and it is very confusing. If you ask ChatGPT, he will be wrong. If you search Google, you will get the wrong answer. If you read the docs, you will be confused since it doesn't clarify. So, I am going to try to explain it here.
Visibility Timeout When Sending/Queuing a Message
This field used to be named initialVisibilityDelay
, which is a great name. It does, in fact, stop any consumer from seeing the message for the specified amount of time. This is useful if you want to queue a message, but not have it processed immediately. For example, if you are queuing a message to be processed in 5 minutes, you would set this field to 5 minutes.
Visibility Timeout When Receiving/Processing a Message
This field is the one that is actually has always been named visibilityTimeout
, and it is the one that is used to control how long a message is invisible to other consumers after it has been received. This is useful if you want to ensure that a message is not processed by multiple consumers at the same time. For example, if you are processing a message that takes 10 minutes, you would set this field to at least 10 minutes so that no other consumer starts processing this (really long, don't actually do this) message while it is already in process.