At my current employer, we deal with a large number of problems whose solution is a distributed system of one kind or another. We’ve used several messaging frameworks in past projects - everything from raw MSMQ through to RabbitMQ, MassTransit, NServiceBus and all sorts of other odds and ends.

All of them had their weak points and we kept finding that we had to write custom code no matter which framework we chose.

So… Damian Maclennan and I built a thing. That thing is called Nimbus. We’re quite proud of it. And here’s why you want to use it.

What is Nimbus?

Nimbus is a nice, easy-to-use service bus framework built on top of the Azure Message Bus and Windows Service Bus stack.

It runs on both cloud-based service bus instances and on-premises installations of Windows service bus and will happily support federation between the two.

Why do I want it?

It’s easy to get up and running

Getting an instance up and running is fast and easy. You’ll need an Azure account (free) and a service bus namespace if you don’t have a local Windows Service Bus installation, after which:

Install-Package Nimbus

followed by some simple configuration code (just copy/paste and change your application name and connection string):

var connectionString = ConfigurationManager.AppSettings["AzureConnectionString"];
var typeProvider = new AssemblyScanningTypeProvider(Assembly.GetExecutingAssembly());
var messageHandlerFactory = new DefaultMessageHandlerFactory(typeProvider);

var bus = new BusBuilder().Configure()
                            .WithNames("TODO Change this to your application's name", Environment.MachineName)
                            .WithConnectionString(connectionString)
                            .WithTypesFrom(typeProvider)
                            .WithDefaultHandlerFactory(messageHandlerFactory)
                            .WithDefaultTimeout(TimeSpan.FromSeconds(10))
                            .Build();
bus.Start();
return bus;

That’s it. You’re up and running.

It’s really easy to use

Want to send a command on the bus?

public async Task SendSomeCommand()
{
    await _bus.Send(new DoSomethingCommand());
}

Want to handle that command?

public class DoSomethingCommandHandler: IHandleCommand<DoSomethingCommand>
{
    public async Task Handle(DoSomethingCommand command)
    {
        //TODO: Do something useful here.
    }
}

It supports both simple and complicated messaging patterns

Nimbus supports simple commanding and publish/subscribe in a way that you’re probably familiar with if you’ve ever used NServiceBus or MassTransit.

It also supports an elegant, awaitable request/response, like so:

var response = await _bus.Request(new HowLongDoPizzasTakeRequest());

It also supports much more advanced patterns like publish and competing subscribe and multicast request/response. I’ll cover each of these in subsequent articles.

Did we mention that it’s free? And open-source? And awesome?

There’s no “one message per second” limit or anything else with Nimbus. It’s free. And open source. You can clone it for yourself if you want - and we’d love it if you did and had a play with it.

If you’d like a feature, ask and we’ll see what we can do. If you need a feature in a hurry, you can just code it up and send us a pull request.

Please… have a look and let us know what you think.