My very first NuGet package — DistributedEventBus

Ha Doan
2 min readMay 20, 2020

I am exciting to announce that I have just created my very first NuGet package for distributed applications.

This library is inspired from EventBus in popular sample micro-service architect at eShopOnContainers, my purpose to make this library to work with many Message Queue services and allow developers to integrate to any application with ease.

Currently, it supports Azure Service Bus and RabbitMQ.

The source-code is available at https://github.com/hadoan/distributed-event-bus and NuGet packages is at https://www.nuget.org/packages/DistributedEventBus/

In the github, I have a very simple example console application that demo this library that including Publisher to publish a Test event and Consumer to subscribe the Test event using Azure Service Bus, and here are steps for sample.

Sample architect to see how to use this library

DistributedEventBus as Pub/Sub channel

Create Publisher console application

  • Install following nuget packages: DistributedEventBus, DistributedEventBus.EventBusServiceBus
  • Create TestIntegrationEvent.cs

In program.cs

  • Declare connection string for your AzureServiceBus
  • Add Microsoft.Extensions.DependencyInjection package and config setup services for distributed event bus
  • After registering services, you can publish Test Event as

Create Consumer console application

  • Add TestIntegrationEvent.cs and TestIntegrationEventHandler.cs to handle the Test Event
  • Register services in Program.cs
  • Please take note that you need to use EventBus to subscribe TestIntegrationEvent as above code

Done, you can see completed sample code at https://github.com/hadoan/distributed-event-bus/tree/master/Example/Example

And here is the result of these 2 applications

Result from the demo

Hope this can help you to build distributed application easier!

--

--