Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using NServiceBus with Asp.Net MVC 2

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 response message. is there a way to do this clearly?

like image 648
Peter Mueller Avatar asked Sep 08 '10 14:09

Peter Mueller


1 Answers

There is a reason that NServiceBus only supports registering callback for status codes and ints. That reason is that you shouldn't use NServiceBus for sync request/response style communications, those scenarios is best solved with frameworks like Wcf, NNibernate , EF, Ado.net etc.

You should look at only use NSB for async parts of your application like to send off "commands" to backend services for processing.

An in depth explanation can be found here:

http://andreasohlund.net/2010/04/22/messaging-shouldnt-be-used-for-queries

If you still want to do request/response with NSB you'll have to work for it :) using a messagehandler for your response that updates some cache in your MVC app. With that in place you can do some ajax style polling to determine when the data arrives.

Hope this helps!

like image 185
Andreas Öhlund Avatar answered Sep 28 '22 05:09

Andreas Öhlund