MSMQ 消息队列没有提供删除消息的方法,但是你读取一个消息后,这个消息会从消息队列里删除。
if (!MessageQueue.Exists(@".\Private$\WCFMSMQ"))//check the queue
{
MessageQueue myqueue = MessageQueue.Create(@".\Private$\WCFMSMQ", true);
string messageId = "121231";
myqueue.ReceiveById(id);
}
也可以使用 myqueue.PeekById(id);
http://www.eggheadcafe.com/community/aspnet/2/10026238/how-to-delete-individual.aspx
http://stackoverflow.com/questions/463418/delete-single-message-msmq
Frank Xu Lei--谦卑若愚,好学若饥
专注于.NET平台下分布式应用系统开发和企业应用系统集成
Focus on Distributed Applications Development and EAI based on .NET
欢迎访问老徐的中文技术博客:
Welcome to My Chinese Technical Blog
欢迎访问微软WCF中文技术论坛:
Welcome to Microsoft Chinese WCF Forum
欢迎访问微软WCF英文技术论坛:
Welcome to Microsoft English WCF Forum