MessageQueue BeginReceive() 方法被调用两次
如果我调用 BeginReceive()
方法两次(一次接一次)会发生什么?
示例:
MessageQueue mq = new MessageQueue("strQueueConnectionhere");
mq.BeginReceive(); // first call
mq.BeginReceive(); // second call
请帮助
thnx :D
What will happen if I call the BeginReceive()
method twice (one after the other)?
Example:
MessageQueue mq = new MessageQueue("strQueueConnectionhere");
mq.BeginReceive(); // first call
mq.BeginReceive(); // second call
Pls help
thnx :D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将有两个异步“
BeginReceive
”调用等待消息进入队列。我猜测当一条消息弹出时,其中一个将处理它并以 ReceiveCompleted 事件完成,而另一个则等待下一条消息。如果您不处理ReceiveCompleted
事件,那么您将看不到任何事情发生。You'll have two asynchronise '
BeginReceive
' calls waiting for a message to go onto the queue. I'm guessing that when a message pops on, then one of those will handle it and will finish with theReceiveCompleted
event while the other one waits for the next message. If you don't handle theReceiveCompleted
event, then you won't see anything happen.