I am working with Windows Azure Message queues. I want know if is there a method to lock messages in the queue when i get them ?
Asked
Active
Viewed 2,846 times
1 Answers
11
When you retrieve a message from the queue, it's marked as invisible until you delete it (or the timeout period is reached). When it's marked as invisible, nobody else sees the message. I guess that's as closed to "locked" as you're going to get.
If, while processing, you feel you need more time, you can modify the message and extend the invisibility timeout.
You do need to focus on idempotent operations with Windows Azure queues: Assume that any given message may be processed more than once:
- Processing goes beyond invisibility timeout, so some other worker gets the message
- VM instance crashes while processing message, causing it to re-appear in the queue and get processed again

curiousBoy
- 6,334
- 5
- 48
- 56

David Makogon
- 69,407
- 21
- 141
- 189
-
Thanks for your post. what is the difference between Queues in the Service bus and the CloudQueues in the storage account ? are they the same ? – GoodSpeed Jun 06 '12 at 21:17
-
2They're not the same. One is based on Windows Azure Storage, and one is based on Service Bus. This [MSDN article](http://msdn.microsoft.com/en-us/library/windowsazure/hh767287.aspx) compares the two. You'd need to select which one fits your app better, based on feature comparison. – David Makogon Jun 06 '12 at 21:24