What is Rebus?

little_rebusbus2_copy-200x235Rebus is a free .NET “service bus” – i.e. it is an implementation of several useful messaging patterns, which have turned out to be immensely useful for implementing asynchronous messaging-based communication between the components of an application.

How does it work?

Rebus is a code library that you bring into your application, and then it sits as an abstraction layer between your application and some kind of queueing mechanism – either a queueing service (like MSMQ), a service broker (like RabbitMQ, Amazon SQS, Azure Service Bus, etc.), or a relational database (MSSQL, PostgreSQL, Oracle), or with its built-in in-memory queues.

This means that your application code is not tied to any specific queueing technology, and thus it is portable and can easily be moved between hosting environments, e.g. into the cloud, into your closet, or into some very realistic unit testing scenarios on your build server.

How does it look?

Rebus makes it possible for you to go

await bus.Publish(new SomethingInterestingHappened(...));

from any application, and then have the SomethingInterestingHappened event dispatched to handlers that look like this:

public class YourEventHandler : IHandleMessages<SomethingInterestingHappened>
{
    public async Task Handle(SomethingInterestingHappened message)
    {
        // ... do what you want in here
    }
}

in any other application that has subscribed by doing this:

await bus.Subscribe<SomethingInterestingHappened>();

That’s pretty neat. 🙂

What does it provide?

It does some nice things because it provides

  • a durable & safe way of exchanging messages across processes and machines
  • a neat model for routing messages based on types
  • a message handler API that makes handling messages easy and fun
  • transport and persistence abstractions that make your application portable and testable
  • a great model for sagas (i.e. stateful services, also known in the literature as “process managers”) and coordinating stuff that happens over time
  • handling of serialization, threading, logging, transactions and errors

and more.

What can you use it for?

Rebus can be used both internally in an application to coordinate things and to queue up work, making the application more robust towards high loads and more capable of handling long-running processes that might consist of several discrete steps.

It can also be used in bigger integration scenarios, where it will usually connect systems using pub/sub messaging and coordinate integrations at the periphery.

Since some of the transports can trivially “cross the borders of your firewall” (like e.g. by leveraging Azure Service Bus), it can also be used as the glue between your internal systems and those you have chosen to host in the cloud, making for a great way to build hybrid cloud applications.

How to get it

Rebus is an ordinary .NET library which is available on NuGet.org as a binary and on GitHub as source code.

If you would like to read some more about it, there’s also a documentation wiki on GitHub.

Rebus is absolutely FREE to use, without any kind of limitations. It will stay that way forever.

Support

The open source bits of Rebus are supported by Rebus.fm – this includes all of the NuGet packages sourced from the official Rebus repository.

Check out Rebus Pro if you are interested in a formal support agreement.