What does MassTransit add to RabbitMQ?

Endy Tjahjono picture Endy Tjahjono · Sep 6, 2012 · Viewed 11.1k times · Source

What is the benefit of building on top of MassTransit compared to building directly on top of RabbitMQ?

I believe one benefit provided by MassTransit is 'type' exchange (publish subscribe by interface / type) so the content of the message is structured, compared to plain RabbitMQ exchanges where the content of the message is unstructured text / blob.

What other benefits provided by MassTransit?

Answer

Chris Patterson picture Chris Patterson · Sep 6, 2012

Things that MT adds on top of just using RabbitMQ:

  • Multithreaded, concurrent consumers
  • Message serialization, including interfaces, and versioning
  • Automatic exchange bindings, publish conventions
  • Sagas, including persistent state via NHibernate
  • Performance counters for your services
  • Message headers
  • Fault handling

Those are just a few, some more significant than others. The fact that the bus hosts your consumers, handlers, sagas, and manages all of the threading is probably the biggest advantage, and the fact that you can host multiple buses in the same process.

Serialization is the next biggest benefit, since that can be painful to figure out, and getting an interface-based message contract with automatic deserialized into types (including dynamically-backed interface types) is huge. Publishing a single class that implements multiple interfaces, and seeing all interested consumers pick up their piece of the message asynchronously is just awesome in production as new interfaces can be added to producers and downlevel consumers are unaffected.

Those are a few, you can check out the documentation for more at http://masstransit-project.com/MassTransit/understand/additions-to-transport.html, or give the recent .NET Rocks! podcast a listen for some related content by yours truly.