Search code examples
nservicebusnservicebus-distributor

NServicebus+RabbitMQ and Distributor


NServiceBus Distributor/Worker pattern makes perfect sense for MSMQ due to the hard requirement of local input queues.

But this is not the case with RabbitMQ, I am trying to understand how and when the NServiceBus distributor is relevant with RabbitMQ. With RabbitMQ multiple workers can read from the same remote queue.

The actual scenario is similar to using an AWS auto-scaling group to scale out workers pointing to a high available RabbitMQ cluster. Now avoiding distributor altogether makes the setup much simpler to build, test and provision.

Thoughts?


Solution

  • NServiceBus is an excellent system and does wonders in most message queuing system where you don't have an integrated distributor (which you do with exchanges in RabbitMQ). We use NServiceBus here at our company.

    Azure Queues and MSMQ are perfect examples of such queuing technologies.

    NServiceBus handles the distribution internally and therefore reproduces this capability for you.

    However... If you are blessed with the possibility of imposing what queuing technology you can use, then I would highly encourage you to look into RabbitMQ and a product (Open Source) called MassTransit

    http://masstransit-project.com/

    MassTransit can in turn function in the two modes and will either delegate or simulate the distribution for you - however I nonetheless have a soft spot for NServiceBus as do our senior devs here.

    Per this page... http://docs.particular.net/nservicebus/load-balancing-with-the-distributor Using the distributor is only useful when using MSMQ - if you aren't using MSMQ then there is no point. RabbitMQ and other transport will allow access to the same queue from multiple consumers, while MSMQ will not. The distributor in a nutshell will take messages from the main queue and distribute them across multiple worker queues as they report that they are done with whatever they are working on.