I have messages that get stuck in queue and I am looking for a way to programmatically remove them.
Is there a way to remove messages from a queue if it has been sitting for more than x days? I can connect and delete a queue like this, but not sure how to remove individual messages.
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);
}