NServiceBus 与大众运输

关于 NServiceBus 和大众运输,我正在纠结一个利弊清单。

我知道这里面已经有一条线索了但它并没有真正回答我的问题。

以下是我目前为止读到的:

  1. NServiceBus,是的,它是有执照的,而且不是免费的。
  2. 大众运输公司,是的,它是开源的,但是文档似乎有些缺乏。

NServiceBus 比较旧,有更多的引用。很难找到关于大众运输的资料,但我思想开放。然而,我必须提供一个可靠的解决方案,所以我不得不问。

所以,请有经验的人在这两个框架。为什么我应该选择 NServiceBus? 或为什么我应该选择大众运输?

是性能,安全性,规模还是?

36872 次浏览

You could always use Shuttle (FOSS): https://github.com/Shuttle/shuttle-esb :)

Documentation (always improving): http://shuttle.github.io/shuttle-esb/

The Shuttle project has been going almost 2 years and is used production systems. It'll be a matter of choosing what resonates with you.

NServiceBus has a good track record. I have used it previously on a production system (1.9) but not since it has gone commercial (the point at which I started with Shuttle).

I haven't tried MassTransit.

I guess all your options will have the basics (command / event / pub-sub). However, NServiceBus does have sagas and the data bus stuff although I reckon it is easy enough to handle data outside of the service bus itself such as in your endpoint message handlers. I don't know whether MassTransit has sagas/data bus but Shuttle certainly doesn't.

Another consideration is probably how you intend using the service bus. If it is to be part of a product then for a commercial option such as NServiceBus you would need to consider the cost implications for users of your product and although it is still something that needs to be considered for in-house development it can certainly be justified.

As the original author of NServiceBus, I'm probably a bit biased towards my own technology, but I'll try to keep this as balanced as I can.

Transport support

Both NServiceBus and MassTransit support RabbitMQ and Azure Service Bus, but NServiceBus also supports:

Not only that, but NServiceBus also enables you to transparently run different endpoints on different transports with its Transport Bridge, a huge deal when integrating on-prem systems with new cloud functionality.

On the topic of RabbitMQ

The argument could be made that NServiceBus has stronger support for RabbitMQ - for example, in its delayed delivery functionality while Mass Transit states that their "plugin is still considered as experimental. It is supported by MassTransit, but we cannot guarantee anything more than the plugin guarantees itself."

We also work very closely with the RabbitMQ team, contributing to the .net SDK for the benefit of the whole ecosystem, and continue to be recognized for it, like in this tweet: https://twitter.com/RabbitMQ/status/1547946916419231744

enter image description here

When it comes to Azure Service Bus

The level of collaboration we have with the Azure Service Bus team is even higher, with over 70 PRs to their .net core SDK.

When you use NServiceBus, you benefit from the full depth of that knowledge.

Tooling

This is the biggest difference.

Once you've built a substantial system, having visibility into how all the different moving parts talk to each other becomes really important. MassTransit doesn't have much in this area beyond a small integration through a Diagnostic Source to 3rd party tools like Application Insights or Open Trace.

The Service Platform around NServiceBus goes quite a bit farther, giving you the ability to see sequence diagrams across all endpoints with ServiceInsight:

Sequence diagrams with ServiceInsight

You can also get the logical view of all of your endpoints and messages:

The logical view of an NServiceBus system

In essence, you get living documentation of your system's architecture.

Management & Monitoring

This is another area where MassTransit doesn't have very much. When a 3rd party system you're integrating with becomes unavailable and a bunch of messages in your system end up in the error queue, the only solution MassTransit has for you to manually move those messages back later using the RabbitMQ Shovel plugin.

The Service Platform around NServiceBus includes monitoring of that error queue, graphical tooling to see what the causes were of those errors, as well as the ability to replay groups of those failed messages and see that they were actually processed successfully all in a simple web app called ServicePulse.

Failed message grouping with ServicePulse

There is also visualization of health checks which are run periodically that can provide early warnings of problems before messages start failing.

And finally, there's the performance monitoring available in the platform:

NServiceBus performance monitoring

You really get the full package when it comes to production support.

Long-term support & Backwards-compatibility

While the Mass Transit folks have always been extremely good at helping anyone who has questions about it on Gitter or their Google Group, I don't think they provide bug fixes on older versions. When your production systems have been around for a couple of years, and you can't just upgrade everything all the time, that starts to be important.

With NServiceBus support includes:

  • 2+ years for each major version
  • An additional 2 years of extended support
  • Guaranteed response times on critical issues
  • 24x7 availability

Risk Management

Chris Patterson, the creator of MassTransit, is a long-time friend and his contributions to the community over the years are such a labor of love that I have nothing but admiration for him.

The thing is, for a number of years now, Chris is the only person that's been working on, or even capable of working on MassTransit. If anything were to happen to him, and I wish him nothing but my very best, I really don't know who could fill his shoes.

For mission-critical projects and products where organizations want to make sure they're building on a solid foundation for years to come, this risk may be untenable. The larger organization around NServiceBus, with dozens of full time staff, and deep partnerships with Microsoft, AWS, and RabbitMQ, would probably be the less risky choice for those environments.

Consulting & Training

From an offline perspective, there are public courses available around the world on NServiceBus as well as many consultants who can be brought on-site to kickstart a project or to assist in case of problems. I've heard from several companies that decided to switch from MassTransit to NServiceBus because they couldn't get someone on-site when they needed it.

Licensing

What some people still don't know about NServiceBus is that it is FREE for personal use and startups, and even for some limited production use too.

FREE for personal use and startups

When it comes to commercial use, the licensing models around NServiceBus are very flexible, as the broad spectrum of customers indicates, and can be well justified to management. Of course, with MassTransit, the licensing is free.

Hope that helps in some way.

If I had to summarize, here's what I'd say:

If you need commercial support, go for NServiceBus. If you're comfortable with using forums as a means of support, MassTransit is a great option. The developers have been very responsive to our issues so far. If you choose MassTransit, now you will choose between MSMQ and RabbitMQ. If you need DTC go with MSMQ. If you want more features and better administration, go with RabbitMQ.

On our project, we switched from NServiceBus to MassTransit for two reasons:

  1. MassTransit is free
  2. We love RabbitMQ

I've used both frameworks. I've used MassTransit longer than NServiceBus. Here are the highlights as I see them.

Cost:

  • MassTransit is Apache 2.0 licensed and free for commercial production use, whereas NServiceBus is not.

Support:

  • As Udi mentioned, there is an option for commercial NServiceBus support, I haven't seen that for MassTransit.

Transport:

  • MassTransit supports MSMQ and RabbitMQ
  • NServiceBus supports only MSMQ RabbitMQ is supported in NServiceBus 4+

RabbitMQ vs MSMQ:

  • MSMQ support DTC (distributed transaction coordinator) for transactions involving multiple processes on potentially multiple machines (e.g. SQL server, Windows Service)
  • RabbitMQ has an excellent Administration interface
  • MSMQ has been around longer and is a Microsoft product
  • RabbitMQ is newer, open source, free, and sponsored by VMWare
  • MSMQ is installed on most Windows machines by default

Udi Dahan and the MassTransit guys (Chris Patterson, Dru Sellers, and Travis Smith) are all brilliant people.

I know it's late to chime in on this question, but for bingleability's sake, I have to mention Rebus (which I happen to be the primary author of).

Rebus is about 8 years old now, and it has been used to move money around and control power plants from the get-go.

It supports most basic queueing systems, like MSMQ, RabbitMQ, Azure Service Bus, Azure Storage Queues, Amazon SQS, etc., but it also supports more funny stuff like using MSSQL, PostgreSQL, and Oracle as transports.

The documentation wiki is fairly comprehensive, although many people seem to get by, because Rebus' APIs are so easily discoverable.

Rebus has always been (and will always be) completely free. It's MIT-licensed, so you can basically do with it what you feel like.

If you end up as a serious Rebus user, and you need a formal support agreement and extra tooling, you can subscribe to Rebus Pro, which is offered by Rebus FM (the company behind Rebus).

The "extra tooling" mentioned above currently comes in the form of Fleet Manager, which can help with things. For example, Fleet Manager completely replaces error queues (i.e. dead-letter queues), so failed messages get stored there instead. This means that failed messages can be viewed, managed, and retried anytime with a few clicks in Fleet Manager.

Just to give a more up to date answer, I've developed professionally with both ecosystems and they both now support a broad range of MQ technologies, and .NET Core.

I used NServicebus a few years back on a new cloud product, we needed .NET Core which Mass Transit didn't support at the time. I have to say - it's a lovely thing to use as developer, there's a lot of nice one liners, great tooling/monitoring and the documentation is really good.

Various levels of support and license are available, and on one occasion we needed some help, it was good quality.


I've been using Mass Transit for a few months at a new company, and they much prefer having a free, open-source library. The journey has been a bit rockier - the documentation for MT is lacking in places, and a lot of examples/issues are out of date. There's not quite the range of advanced features either, but you may well not need them for their use case.

It works fine though, and the MT developers seem to put a LOT of effort into supporting their OSS - way beyond what you could reasonably expect.

So personally, my TLDR would be - get NServicebus if your company can be convinced to pay for it, but MT is a serviceable alternative and the best you can get for gratis.