开发者

Adding Message to MessageQueue programmatically

开发者 https://www.devze.com 2023-02-05 05:50 出处:网络
I have the old \'non-transactional\' queue (MessageQueue) which may have messages in it. Now programatically, I want to:

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");

0

精彩评论

暂无评论...
验证码 换一张
取 消