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 ?

有帮助吗?

解决方案

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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top