Monday, 20 November 2017

Enterprise Service Bus libraries for .NET – Nimbus

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

Nimbus primarily supports the Azure Service Bus as a transport, so if your application is going to run in Azure, then this could be a good choice.

https://github.com/NimbusAPI/Nimbus/wiki/Publishing-an-Event-on-the-Bus

Messages

Event messages should implement IBusEvent

Publishing

Publish with an instance of IBus

_bus.Publish(new NewOrderReceived {CustomerName = "Ricky Bobby"});

Subscribing

Handle events by implementing IHandleMulticastEvent

public class ListenForNewOrders : IHandleMulticastEvent
{
 
    public async Task Handle(NewOrderReceived busEvent)
    {
        Console.WriteLine("I heard about a new order from " + busEvent.CustomerName);
 
        //Do more stuff
    }
}

No comments: