Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How long does a Message stay hidden in an Azure Queue before it gets made visible again?

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?

like image 978
Pure.Krome Avatar asked Oct 16 '13 07:10

Pure.Krome


2 Answers

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.

like image 120
Gaurav Mantri Avatar answered Sep 22 '22 23:09

Gaurav Mantri


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.

like image 33
Neil Mackenzie Avatar answered Sep 20 '22 23:09

Neil Mackenzie