将消息发送到已删除的队列中时,没有发生异常 [英] No exception occured while sending message into deleted queue
本文介绍了将消息发送到已删除的队列中时,没有发生异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下示例应用程序可在.Net Framework 2.0上运行,并且不会引发任何异常.
这是一个错误吗?有什么解决方法吗?
The following sample application works on .Net Framework 2.0 and doesn't raise any exception.
Is it a bug? Is there any workaround?
using System;
namespace MQDeleteTest
{
class Program
{
static void Main(string[] args)
{
try
{
// Local public queue.
string queuePath = ".\\TestQueue";
System.Messaging.MessageQueue.Create(queuePath);
System.Messaging.MessageQueue queue =
new System.Messaging.MessageQueue(queuePath, false, false);
queue.Send("A test message 1.");
System.Messaging.MessageQueue.Delete(queuePath);
// an exception expected!!!
queue.Send("A test message 2.");
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}
推荐答案
失败的消息进入死信队列,不生成任何异常.在此处阅读更多信息: http://msdn.microsoft.com/en-us/library/ms789035.aspx
failed messages go to the dead letter queue, no exception is generated. Read more here: http://msdn.microsoft.com/en-us/library/ms789035.aspx
这篇关于将消息发送到已删除的队列中时,没有发生异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文