简体   繁体   English

MSMQ - 队列进程重启/服务器重启后队列是否存在

[英]MSMQ - can a queue survive a queue process restart/server restart

Can an MSMQ queued messages survive a service/server restart? MSMQ排队的消息能否在服务/服务器重启后继续存在? What I mean is that if a queue has messages and the server were to experience a hard restart, would the messages be still available in the queue after the restart? 我的意思是,如果一个队列有消息并且服务器要经历硬重启,那么重启后消息是否仍然可以在队列中使用?

To achieve this you have to mark the messages as Recoverable. 要实现此目的,您必须将消息标记为可恢复。 By default, MSMQ messages are only held in memory, but Recoverable messages are backed to disk to enable reliable MSMQ Messaging. 默认情况下,MSMQ消息仅保留在内存中,但可恢复消息将备份到磁盘以启用可靠的MSMQ消息传递。

using System.Messaging;

Message recoverableMessage = new Message();
recoverableMessage.Body = "Sample Recoverable Message";
recoverableMessage.Recoverable = true;
MessageQueue msgQ = new MessageQueue(@".\$private\Orders");
msgQ.Send(recoverableMessage);

There is an overview of this area at Reliable Messaging with MSMQ and .NET . 使用MSMQ和.NETReliable Messaging中概述了该领域。

Transactional messages do not need to be manually marked as recoverable - this is implicit in the fact they are part of an MSMQ-based transaction. 事务性消息不需要手动标记为可恢复 - 这是隐含的,因为它们是基于MSMQ的事务的一部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM