Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do we need service bus frameworks like NService Bus/MassTransit on top of message queuing systems like MSMQ/RabbitMQ etc?

In the distributed message transaction world, am trying to understand the different parts that are involved in developing distributed systems. From what I understand you can design messaging system using enterprise bus backed with a message queue system. Why is it a good idea to use both? Can the same be achieved by programming against just the message queuing system? What are the advantages of using both together?

like image 950
Chrysalis Avatar asked Sep 20 '14 22:09

Chrysalis


People also ask

What is the difference between NServiceBus and RabbitMQ?

According to the StackShare community, RabbitMQ has a broader approval, being mentioned in 1224 company stacks & 2896 developers stacks; compared to NServiceBus, which is listed in 9 company stacks and 6 developer stacks.

What is MassTransit service bus?

MassTransit is a lightweight service bus for building distributed . NET applications. The main goal is to provide a consistent, . NET friendly abstraction over the message transport (whether it is RabbitMQ, Azure Service Bus, etc.).

What is NServiceBus?

NServiceBus is a commercial messaging framework provided by Particular Software. It's built on top of Azure Service Bus and helps developers focus on business logic by abstracting infrastructure concerns. In this guide, we'll build a solution that exchanges messages between two services.


2 Answers

You certainly can code directly against the messaging infrastructure and you will find that there are pros and cons w.r.t. each transport. There are many decisions that you will need to make along the way, though, and this is where a service bus may assist.

Developing directly against the queuing system will inevitably lead to various abstractions that you will require to prevent duplication.

A service bus will provide opinions/implementations for:

  • Message delivery
    • exactly-once (distributed transactions - distributed transactions are not supported by all queuing systems)
    • at-least-once (non-transactional)
    • at-most-once (will probably require some transactional processing but you can get away with no distributed transactions)
  • Retrying failed messages
  • Request / Response
  • Message distribution
  • Publish/Subscribe (probably quite easy with RabbitMQ directly, not so much with MSMQ directly)
  • Message Idempotence
  • Dependency Injection

Some service bus implementations provide a framework for implementing process managers (called sagas by most). My current opinion is that a process manager needs to be a first-class citizen as any other entity is but that may change :)

Anyhow, if you as still evaluating options you could also take a look at my FOSS project: http://shuttle.github.io/shuttle-esb/

So a service bus may buy you quite a bit out-of-the-box whereas coding against the queues directly may be a bit of work to get going.

like image 111
Eben Roux Avatar answered Sep 30 '22 12:09

Eben Roux


I can't comment directly on MassTransit, having only tinkered with it.

I use NServiceBus and am a fan of it. I think there are valid reasons for directly using queuing technology, but I think rolling your own ESB using MSMQ/RabbitMQ would cost a lot more than simply using a commercial product (or open source product e.g. MassTransit).

So do you need it? No. Will it make your life much easier if the features match your requirements? Absolutely.

like image 24
Phil Sandler Avatar answered Sep 30 '22 14:09

Phil Sandler