Azure Service Bus客户端:等待服务器响应的最佳方式?

时间:2014-01-13 21:44:54

标签: c# multithreading azure asynchronous azureservicebus

我有一个需要在Azure Service Bus上发送请求并等待响应的Web服务。从Web服务客户端看,Web服务必须同步运行,即:

public Response WebServiceMethod(Request)
{
   senderQueueClient.Send(Request);

   // wait for response from receiverQueueClient.OnMessage(..)
   // and return to web service client

   return response;
}

我已经搜索了这个主题,但是对于这个特定的情况来说很简短,可能会有很多并发的Web服务调用,而且我知道“receiverQueueClient.OnMessage(..)”中的响应是在不同的线程中传递的

如何解决这个问题? ManualResetEvent还是在.NET4.5中使用新的await / async?

感谢。

0 个答案:

没有答案
相关问题