Giter Club home page Giter Club logo

easybus's Introduction

EasyBus

Lightweight Message Bus for .Net Easy integration with multiple messaging frameworks including RabbitMQ, ActiveMQ ,maybe MSMQ

Build status

EasyBus Logo

Easy to install

EasyBus.RabbitMQIntegration is on NuGet. To install it, run the following command in the Package Manager Console

Install-Package EasyBus.RabbitMQIntegration

Initialize IocBootstrapper

Container container = new Container();

//auto search all message handlers and register
container.RegisterSingle<ISubscriber>(new Subscriber(container));

var assembly = AppDomain.CurrentDomain.GetAssemblies().Where(x => x.FullName.Contains("EasyBus.Consumer")).FirstOrDefault();

var handlers = assembly.GetExportedTypes().Where(x => x.IsMessageHandler(typeof(MessageHandler<>))).ToList();

var responders = assembly.GetExportedTypes().Where(x => x.IsMessageHandler(typeof(MessageResponder<,>))).ToList();

container.RegisterAll<IMessageHandler>(handlers);
container.RegisterAll<IResponse>(responders);
container.RegisterSingle<IPublisher>(new Publisher(container));
container.RegisterSingle(new MessageEmitter(container));
container.RegisterSingle(new RabbitMQIntegrationModule(container));

How to use?

Naming Convention for error strategy ......

<!--Number of multi-thread subscriber-->
<add key="MaxThreads" value="10" />

Pub / Sub Sample

// Find subsriber. (RabbitMQ, ActiveMQ etc.)
var subscriber = container.GetInstance<ISubscriber>();

// Find all message handlers in running process
var messageHandlers = container.GetAllInstances<IMessageHandler>();

console.WriteLine(messageHandlers.Count() + " subscriber found.", ConsoleColor.Green);

//Start to subscribe (async) for all message handlers
foreach (var item in messageHandlers)
{                    
		subscriber.Subscribe(item);
	
}

EasyBus Consumer

Specify how the policy should handle consumer faults

<add key="RetryInterval" value="1" />
<add key="RetryCount" value="3" />
 
Policy.Execute<OperationResult>(() =>
{
	
}, message);

easybus's People

Contributors

serdardemir avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

chen19890425 xusp

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.