消息在MSMQ中丢失 [英] Message Lost in MSMQ

查看:91
本文介绍了消息在MSMQ中丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个公共队列,并使用Windows服务应用程序向队列发送了一些消息。发送应用程序在与队列相同的服务器上执行(即,这是本地队列)。



重新启动服务器后,所有排队的消息都被清除。有没有办法在服务器重启后保留这些消息?

I''ve created a public queue and sent some messages to the queue using a windows service application. The sending application executes on the same server as the queue (i.e. this is a local queue).

After restarting the server, all of the queued messages were purged. Is there any way to persist these messages after a server restart?

推荐答案

要实现这一点,您必须将消息标记为可恢复。默认情况下,MSMQ消息仅保存在内存中,但可恢复消息将备份到磁盘以启用可靠的MSMQ消息传递。



使用System.Messaging;



消息recoverableMessage = new Message();

recoverableMessage.Body =Sample Recoverable Message;

recoverableMessage.Recoverable = true ;

MessageQueue msgQ = new MessageQueue(@。\
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.

using System.Messaging;

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


private\Orders);

msgQ.Send( recoverableMessage);



详情请见以下链接: -



http://msdn.microsoft.com/en-us/library/ms978430.aspx#bdadotnetasync2_topic2 [< a href =http://msdn.microsoft.com/en-us/library/ms978430.aspx#bdadotnetasync2_topic2target =_ blanktitle =New Window> ^ ]
private\Orders");
msgQ.Send(recoverableMessage);

Details can be found at the below link:-

http://msdn.microsoft.com/en-us/library/ms978430.aspx#bdadotnetasync2_topic2[^]


这篇关于消息在MSMQ中丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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