One in a series of posts giving a quick overview of ESB libraries for .NET

Rebus describes itself as "a lean service bus implementation for .NET".

https://github.com/rebus-org/Rebus

Messages

POCO classes

Publishing

Use an instance of IBus to publish.

activator is an implementation of IHandlerActivator - either BuiltinHandlerActivator or an adapter class for your particular IoC container.

activator.Bus.Publish(new DateTimeMessage(DateTime.Now)).Wait();

Subscribing

Handlers implement IHandleMessages<T>

public class PrintDateTime : IHandleMessages<DateTime>
{
    public async Task Handle(DateTime currentDateTime)
    {
        Console.WriteLine("The time is {0}", currentDateTime);
    }
}

And register a subscription

activator.Bus.Subscribe<StringMessage>().Wait();