4

I'm trying to add functionality to a system support website that will move messages from the poison queue back to the processing queue. This is what I've attempted so far:

// path = "FormatName:DIRECT=OS:machine-name\private$\queue-name";

var poisonQueue = new MessageQueue(path + ";poison");
var processingQueue = new MessageQueue(path);

foreach(var message in poisonQueue.GetAllMessages())
{
    processingQueue.Send(message);
}

var poisonCount = poisonQueue.GetAllMessages().Count();
var processingCount = processingQueue.GetAllMessage().Count();

Unfortunately, Send() doesn't seem to be doing anything. The debugger shows the counts as:

poisonCount: 6
processingCount: 0
Didaxis
  • 8,486
  • 7
  • 52
  • 89
  • 1
    Just a thought, why not explicitly declare your variables? I've learned this the hard way; never allow the compiler to choose variable types for you. – Dayan Jul 25 '12 at 17:13
  • Does this answer your question? [Azure: How to move messages from poison queue to back to main queue?](https://stackoverflow.com/questions/33252196/azure-how-to-move-messages-from-poison-queue-to-back-to-main-queue) – Michael Freidgeim Jan 25 '20 at 12:55

1 Answers1

2

You should move poison messages to retry queue and then messages will be processed again

please look here for more details

GSerjo
  • 4,725
  • 1
  • 36
  • 55
  • I ended up using the unmanaged API that you linked to. That worked for me – Didaxis Jul 25 '12 at 20:52
  • 2
    For those wondering how to move messages between queue and subqueues (including poison) see http://stackoverflow.com/questions/5585609/how-to-move-a-msmq-message-to-a-subqueue – Mike Nov 16 '12 at 15:05