从 MSMQ 中删除消息
我有一个使用 GetAllMessages 读取 MSMQ 的程序,但它不会从队列中删除消息,因此我有以下代码;不断收到相同的消息。我不想一次又一次地处理相同的消息。我如何确保 MSMQ 删除那些已收到的消息或至少我没有收到它?
while()
{
Messages[] receivedMessage = queue.GetAllMessages()
foreach(Message msg in receivedMessage)
{
... Processing
}
}
I have program which reads MSMQ
using GetAllMessages but it does not remove messages from Queue so I have following code; which keep getting same messages. I do not want to process same message again and again. How can I make sure that MSMQ deletes those already received messages or atleast I don't receive it ?
while()
{
Messages[] receivedMessage = queue.GetAllMessages()
foreach(Message msg in receivedMessage)
{
... Processing
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GetAllMessages() 为您提供队列中消息的副本,但不会删除它们。
使用任何接收方法接收消息并从队列中删除消息
GetAllMessages() gives you a copy of the messages in the queue, but doesn't delete them.
Use any of the Receive methods to receive and remove the messages from a queue