Windows重启后MSMQueue的值还能保留吗?
我有一个现有的系统,想知道 MSMQueue 重新启动后是否可以保留队列的值。当我重新启动时它会清除该值。
I have an existing system and am wondering if MSMQueue can retain value of queue if it restarts. It clears the value when I restart.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如 paxdiablo 所写,MSMQ 是一个持久队列解决方案,但默认情况下不是!默认情况下,将消息存储在 RAM 中,并让 MSMQ 将消息保存到磁盘,以便在服务器崩溃时消息不会丢失,您必须在每个消息上指定它。
如果您查看属性消息.可恢复。
As paxdiablo writes MSMQ is a persistent queueing solution, but not by default! The default is to store messages in RAM and to have MSMQ to persist messages to disk so they are not lost in case of a server crash you have to specify it on EACH message.
More information on this can be found if you take a look at the property Message.Recoverable.
正如 @Kjell-Åke Gafvelin 已经说过的,您可以配置每条消息,但恕我直言,更方便的方法是将其设置在队列本身上。
从上面的文章(我的重点):
此外,您应该使队列事务性以保证消息的正确发送和接收。
(编辑 2020 年 10 月 27 日:删除了外部 Microsoft 帖子“使用 MSMQ 和 .NET 进行可靠消息传递”的链接,因为它不再可用。)
As @Kjell-Åke Gafvelin already said, you may configure each message, but the IMHO more convenient way would be to set it on the Queue itself.
From the article above (highlights by me):
Aditionally, you should make the queue transactional to guarantee the correct shipment and receiving of a message.
(Edit 2020-10-27: Removed link to external Microsoft post "Reliable messaging with MSMQ and .NET" as it is not available anymore.)
是的,MSMQ 是一个持久排队解决方案。它将消息安全地存储在后备存储上,不会受到断电的影响(当然,除非您经历过诸如磁盘因真正的大规模电涌而崩溃之类的情况)。
它的全部目的是在可能不可靠的环境中提供可靠的消息排队。为此,当特定服务器出现故障时丢失消息将是一个相当大的缺点。
来自 Microsoft 自己的页面(以及对类似推销的语言表示歉意):
Yes, MSMQ is a persistent queueing solution. It stores messages securely on backing storage that will not be affected by loss of power (unless you experience things like the disk blowing apart from a truly massive power surge of course).
Its whole point is to provide reliable queueing of messages in a potentially unreliable environment. To that end, losing messages when a particular server went down would be a considerable disadvantage.
From Microsoft's own pages (and apologies for the sales-pitch-like language):