Giter Club home page Giter Club logo

eventtower's Introduction

EventTower

A message bus implementation with functionality sending commands/events to other processes by using RabbitMQ.

Give a star

If you like this repository or you've learned something please give a star ⭐Thanks!

How EventTower works

EventTower

EventTower uses RabbitMQ.Client package to establish a connection to the given RabbitMQ server. Uses an abstraction layer called 'RabbitMQAdapter' to publishing/subscribing logic. For more information take a look at my blog post.

Installation

.NET Core CLI

dotnet add package EventTower

NuGet package manager

Install-Package EventTower

Usage

Setting up an endpoint

Create a messaging endpoint and call Start() method.

 var endpoint = Endpoint.Create("sender");
 endpoint.Start()

Sending commands

Create a command class implements the EventTower.ICommand interface and use Send() method to send the command to the destination endpoint.

var command =  new  CreateOrderCommand();
endpoint.Send(command, "destinationEndpoint");

Publishing events

Create an event class implements the EventTower.IEvent interface and Use Publish() method to publish the event to all destinations.

var @event =  new  CustomerEmailChanged();
endpoint.Publish(@event);

Handling Commands/Events

Create a handler class that implements IMessageHandler<T> interface. The generic parameter must be ICommand or IEvent. A sample event handler is shown below. Commands are handles in the same way.

public  class  EventHandler :
	IMessageHandler<CustomerEmailChanged>
{
	public  Task  Handle(CustomerEmailChanged message)
	{
		Console.WriteLine("An CustomerEmailChanged event received. Content: {0}", JsonConvert.SerializeObject(message));
		return Task.CompletedTask;
	}
}

Runtime Demo

Runtime demo

eventtower's People

Contributors

fatihdumanli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

eventtower's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.