Enterprise Service Bus libraries for .NET
As a software application becomes larger, you may want to break it into separate parts, both to manage complexity but also to aid scalability. But if you break an application apart, how will the separate parts communicate? One approach is to employ messaging using a publish/subscribe (pub/sub) bus.
A few years ago, I worked on an application that used NServiceBus just for this purpose, but I thought it would be useful to survey the .NET landscape to find out what’s available today.
Here’s a summary of the libraries I’ll be looking at over the next few blog posts:
|NServiceBus v6||https://docs.particular.net/nservicebus||Azure Service Bus, In-memory?, MSMQ, RabbitMQ, SQL Server||4.5.2||Commercial||-|
|MassTransit||http://masstransit-project.com/||Azure Service Bus, In-memory, RabbitMQ||4.5(.2?)||Apache 2.0||GreenPipes (>= 1.2.0)
NewId (>= 3.0.1)
Newtonsoft.Json (>= 10.0.3)
Newtonsoft.Json.Bson (>= 1.0.1)
|NimbusAPI||https://github.com/NimbusAPI/Nimbus||Azure Service Bus||4.5||MIT||Microsoft.WindowsAzure.ConfigurationManager (= 2.0.3)
Nimbus.InfrastructureContracts (>= 188.8.131.52)
Nimbus.MessageContracts (>= 184.108.40.206)
WindowsAzure.ServiceBus (>= 2.1.3 && <= 2.1.4)
|Shuttle.Esb||http://shuttle.github.io/shuttle-esb/||MSMQ, RabbitMQ, SQL Server||4.0?||BSD 3||Shuttle.Core.Infrastructure (>= 8.0.6)|
|Rebus||https://github.com/rebus-org/Rebus||Azure Service Bus, MSMQ, RabbitMQ||4.5||MIT||Newtonsoft.Json (>= 9.0.1)|
These libraries range from the relatively simple and tightly focused to the complete ‘enterprise-level’ configurable, extensible and/or fully supported.
Some of these libraries distinguish between an ‘event’ (notify subscribers that something has happened) and a ‘command’ (tell subscribers that they should perform an action). Some support long-running business processes, often known as ‘sagas’. Some support distributed transactions. Some use dependency injection and can integrate with an inversion-of-control container.
And because the feature sets vary so widely, I’ll just be highlighting how each library implements publishing an ‘event’ message, and how you subscribe to these messages.