Developing a good interface for using RabbitMQ from ASP.NET MVC and production applications

A look at creating a web application that runs on MVC4 in AppHarbor. In the interest of responsiveness and performance, slightly longer tasks (typically creating / sending emails, resizing images, processing payment transactions, etc.) will be handled by placing the message in a message queue.

There will also be one or more workers, somewhere out there, unloading messages and processing everything that needs to be processed as a result. The central queuing mechanism will be RabbitMQ, in particular the hosted CloudAMQP service, available through AppHarbor. Theoretically, this architecture would allow "infinite" scalability, adding more workers.

Now, in the interests of good architecture, testability, etc., I want to put RabbitMQ on one or more interfaces that can be easily ridiculed. I have a few considerations to consider when defining these interfaces.

  • Until I get paid users, I am limited to the free CloudAMQP offer. This means a maximum of three simultaneous connections.
  • Given the previous limitation, I want to try to limit myself to one connection for each application. One for the MVC application, one for each employee. It is he.
  • Connections at RabbitMQ are designed for long stays. However, many examples show code that explicitly opens a connection (then a channel), sends a message, and then closes it again.
  • , . , , , .
  • MVC . , - , , , .
  • MVC - .
  • , .

, , . RabbitMQ , .

  • . - , IQueueServiceConsumer IQueueServiceProducer - ? , SRP .., , , (, ), , .
  • , -, , -? , , , . .
  • ? Ninject ( RabbitMQ) -, ... ? - ?
  • . , , . , , CloseConnection. IDisposable.
  • - - RabbitMQ - , , ( , ).

- ? - ? ?

, , , .

!

+5
2
+1

NServiceBus, RabbitMq. NSB 3.2, , .

+1

All Articles