0
votes

I have the old 'non-transactional' queue (MessageQueue) which may have messages in it.

Now programatically, I want to: 1. Get the messages from old queue ----> this is done 2. Create new 'transactional' queue ---> this is also done 3. Copy messages from old message queue to new queue -----> How to do this? 4. Delete the old queue. --- > I can do it by calling Close(), then Dispose() for the old queue and the I can delete the queue using MessageQueue.Delete(). Is it right? And is it necessary to call Close and Dispose before deleting the queue?

Please guide me regarding questions in bold letters.

1

1 Answers

1
votes

You must read the contents of message from old queue and Send it to new queue as new message. There is no Copy method.

To delete a queue, you can use static method, so the Close / Dispose does not apply:

System.Messaging.MessageQueue.Delete(@"myMachine\MyQueue");