使用Windows Azure队列将消息锁定在队列中 [英] Locking messages in queue with Windows Azure Queues

查看:84
本文介绍了使用Windows Azure队列将消息锁定在队列中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Windows Azure消息队列.我想知道是否有一种在收到消息时将消息锁定在队列中的方法吗?

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.

您确实需要关注Windows Azure队列的幂等操作:假定任何给定消息都可以被处理多次:

You do need to focus on idempotent operations with Windows Azure queues: Assume that any given message may be processed more than once:

  • 处理过程超出了可见性超时范围,因此其他工作人员可以收到消息
  • VM实例在处理消息时崩溃,导致其重新出现在队列中并再次得到处理

这篇关于使用Windows Azure队列将消息锁定在队列中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆