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 开发者_如何学Pythonand 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.
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");
精彩评论