Using NServiceBus with Asp.Net MVC 2

前端 未结 3 2144
日久生厌
日久生厌 2021-01-31 23:51

Is there a way to using NServiceBus with Asp.Net MVC 2? I want to send a request message from a Asp.Net MVC2 Application to a Service, which handle the message and reply with a

3条回答
  •  天命终不由人
    2021-02-01 00:16

    If you really want to do this, here's how:

    var sync = Bus.Send(/*data*/)
        .Register((AsyncCallback)delegate(IAsyncResult ar) {
            var result = ar.AsyncState as CompletionResult;
    
            // do something with result.Messages
        },
        null
    );
    
    sync.AsyncWaitHandle.WaitOne(/*timeout*/);
    

提交回复
热议问题