Question

With any normal Azure Queue, I pop a message, then do some work. I didn't want to delete the message until after the work is done.

How long does that message stay hidden before it's deemed a failure and is made visible again on the queue?

eg.

var message = myQueue.GetMessage();

 // Do Work ..

myQueue.DeleteMessage();

My work could take .. 30 secs or something. or what happens if it took .. 1 min or 2?

I basically don't want the message to be come available again before the work is complete, incase another worker pops it off the queue .. even though this worker is still doing work.

Can we set the 'hide' time?

Was it helpful?

Solution

Can we set the 'hide' time?

Yes. You can set the time for which a message will be hidden to other callers. If you look at the REST API documentation for Get Messages, it expects a parameter called visibilitytimeout. This parameter is responsible for hiding the message for specified number of seconds. After that time period has elapsed, the message becomes visible again if not deleted.

How long does that message stay hidden before it's deemed a failure and is made visible again on the queue?

If you're using .Net Storage Client library, you have an option to specify the visibility timeout period. Take a look at the documentation for Get Message where you can specify the visibility timeout. Since this is an optional parameter in the library (but required at the REST API level), default value provided by the library is 90 seconds.

OTHER TIPS

You can specific a Visibility Timeout as a parameter to one of the GetMessage() overloads. You can also use UpdateMessage() to extend the invisibility of the message. However, you can never guarantee that the message will not be processed twice - e.g., the consumer dies having completed the work but before deleting the message. Windows Azure Queues is a best-effort FIFO queue - with at-least once semantics.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top