以编程方式将消息添加到 MessageQueue
我有旧的“非事务性”队列(MessageQueue),其中可能有消息。
现在以编程方式,我想: 1.从旧队列中获取消息---->这是完成了 2. 创建新的“事务”队列 --->这也完成了 3.将旧消息队列中的消息复制到新队列-----> 如何做到这一点? 4. 删除旧队列。 --->我可以通过调用 Close(),然后调用旧队列的 Dispose() 来完成此操作,然后我可以使用 MessageQueue.Delete() 删除队列。 是吗?删除队列之前是否有必要调用 Close 和 Dispose?
请指导我有关粗体字的问题。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须从旧队列中读取消息内容并将其作为新消息
发送
到新队列。没有复制方法。要删除队列,您可以使用静态方法,因此 Close / Dispose 不适用:
System.Messaging.MessageQueue.Delete(@"myMachine\MyQueue");
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");