我有留在队列中的消息,我正在寻找一种以编程方式删除它们的方法。如何从队列中删除消息?
有没有办法从队列中删除消息,如果它已经坐了超过x天? 我可以连接和删除这样的队列,但不知道如何删除单个消息。
MessageQueue queue = new MessageQueue(@".\private$\SomeTestName");
//queue.Purge(); //deletes the entire queue
try
{
// Peek and format the message.
Message m = myQueue.Peek();
// Display message information.
Console.WriteLine("Sent time {0}", m.SentTime);
Console.WriteLine("Arrived time {0}", m.ArrivedTime);
}
可能重复[?如何从消息队列消息(仅当其良好的格式化)](http://stackoverflow.com/questions/5115832/how-to -remove-message-from-message-queue-only-if-its-well-formatted) – OldProgrammer