Search code examples
c#asp.netasp.net-mvcasp.net-web-apinservicebus

Proper usage of NServiceBus in Asp.NET web api


Have I figured Using NServiceBus with ASP.NET MVC correctly?

  1. User sends his request to WebApi controller
  2. Controller (client) creates command and sends it to bus to release worker thread, so api can handle more requests.
  3. Console application (server) subscribes for that command and handles it via some domain logic
  4. Information goes back to the client (controller)
  5. Client returns request back to the user.

Is console application just for the brevity and i should use something such as windows service to handle commands?

enter image description here


Solution

  • For the Async Controller yes, you are correct.

    As far as the server is concerned, yes we use console applications to make the samples easy to run. For an actual service I would recommend checking out the windows service bootstrapper we have created. More information is available at http://docs.particular.net/nservicebus/hosting/windows-service