NServiceBus

NServiceBus: An Experience Report

I’ve been working with NServiceBus (part of the Particular platform) for the past 5 years. In all this time, I’ve always been impressed with the community around it. This article is my experience report. I’ll go over some of the highlights of working with this great piece of technology:

  • how it helped me learn the principles of SOA
  • its developer-friendliness
  • the documentation
  • the community

Principles of Service Oriented Architecture

NServiceBus was founded by Udi Dahan. Udi is a well known SOA specialist. So you can bet that NServiceBus helps you follow the core tenants of SOA. Even if you don’t use NServiceBus, but you’re interested in SOA, I highly recommend following Udi and the rest of the people in Particular. Much of the content that they put out there is technology agnostic.

When I first started using NServiceBus I had a very different view of what SOA means. During these 5 years, I’ve learnt how to use NServiceBus and the rest of the tools in the Particular platform. This was nice, but it’s not the most important lesson. What is, by far, more important is that I’ve learned how to apply the principles, practices and patterns of (event-driven) SOA. This knowledge is valuable, regardless of the technology. I can apply it on any project, even if I don’t use NServiceBus (although NServiceBus makes things a lot easier).

Developer-Friendly

NServiceBus’s tagline is “The most developer-friendly service bus for .NET“. I haven’t used other service buses for .NET, so I can’t say if this is true or not. But it is, by far, the most developer-friendly tool I’ve used. The platform is comprehensive. NServiceBus pretty much has all the features that you would expect from a mature service bus. It contains components for debugging and monitoring. It is extensible (proved by the large number of extensions and integrations). Actually, the main feature that I think it’s missing is an integration test framework. But, apparently, they are spiking this feature, so maybe we’ll have a solution soon.

NServiceBus is easy to use. Things are where you expect them to be and do what you expect them to do. It clearly follows the Principle of Least Astonishment. Have a look at this code snippet (from their documentation):

public class MySagaFinder : 
   IFindSagas<MySagaData>.Using<MyMessage>

What do you expect this class to do? Hmm…maybe find sagas with data MySagaData using messages of type MyMessage? Yeap, that’s exactly what it does. It’s really easy to explore the API and understand what each class or method is doing.

And things just work. When they don’t, it’s damn clear why. Here’s an exception message as an example:

System.Exception: 
Cannot generate a concrete implementation for ‘IMainframeHandler’ because the interface contains methods.
Ensure  interface messages do not contain methods. 

Now tell me what’s the problem? Easy, right? All NServiceBus exception messages are like this. They tell you what’s wrong and how to fix it.

Documentation

The team in Particular pay a lot of attention to documentation. And I mean A LOT. New to messaging and NServiceBus and don’t know how to get started? Just have a look at these tutorials. Want to see how you could use Fluent Validation to validate your message? Have a look at this sample. Don’t know how you should design your messages? Check the docs. Need to upgrade from NServiceBus 6 yo 7? No problem, just go over this upgrade guide. These are just a few examples. Over the years I’ve relied on the docs to answer many, many questions. I’ve ran many of the code samples to test stuff or to reproduce bugs. The documentation has been massively useful.

On a side note, it seems that Particular are using the documentation as code approach. I get the feeling that documentation is a first class citizen of the platform, not just an afterthought. Just have a look at the recent activity in the documentation repository.

Community

One of the greatest things about NServiceBus is the community around it. It’s full of really helpful people. I was subscribed to the Particular Software Google Group. It was very active and people always provided valuable insight. Every time I asked a question I got a response in a timely manner. When I posted about a potential bug in NServiceBus, a bug was raised and the issue was fixed in no time. Now they moved the discussion group to a new place and it’s still very active. I found it very useful to read about what problems other people had and how they solved them.

Also, while working with NServiceBus I got to know about many SOA experts from the Particular community. Here are just a few of them: Udi Dahan, Jimmy Bogard, Indu Alagarsamy, David Boike, Sean Farmar, Mauro Servienti, Daniel Marbach.

These are really smart people that put a lot of content out there (through books, blogs, tutorials, courses, videos, etc). If you’re interested in building distributed systems, make sure to follow them.

Conclusion

NServiceBus is a great tool. But what amazed me are not necessarily the technical aspects. It’s the ethos. It’s the fact that it helps you learn SOA. It’s its developer-friendliness and the emphasis on documentation. Last, but not least, it’s the community behind it. A BIG thank you for building a great product and a great community!