简体   繁体   English

MessageQueue BeginReceive() 方法调用了两次

[英]MessageQueue BeginReceive() method called twice

What will happen if I call the BeginReceive() method twice (one after the other)?如果我调用BeginReceive()方法两次(一个接一个)会发生什么?

Example:例子:

MessageQueue mq = new MessageQueue("strQueueConnectionhere");
mq.BeginReceive(); // first call
mq.BeginReceive(); // second call

Pls help请帮忙

thnx:D谢谢:D

You'll have two asynchronise ' BeginReceive ' calls waiting for a message to go onto the queue.您将有两个异步“ BeginReceive ”调用等待将 go 发送到队列中的消息。 I'm guessing that when a message pops on, then one of those will handle it and will finish with the ReceiveCompleted event while the other one waits for the next message.我猜当消息弹出时,其中一个将处理它并以ReceiveCompleted事件结束,而另一个等待下一条消息。 If you don't handle the ReceiveCompleted event, then you won't see anything happen.如果您不处理ReceiveCompleted事件,那么您将看不到任何事情发生。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM