Coder Social home page Coder Social logo

appbus's Introduction

AppBus is a small application bus that I borrowed from MvcContrib's Portable Areas. I liked the idea of a simple, syncronous bus for decoupling, I took the ideas and wrote my own implementation.

The main difference between MvcContrib and this is that I filter the handlers according to type. In other words, message handlers can handle only one type of message, and only the handlers that can handle a specific message are instantiated when a message is passed to the bus.

public class SomethingHappened : IEventMessage {}

public class DoSomethingWhenSomethingHappens : IMessageHandler<SomethingHappened>{
	public void Handle(SomethingHappened message){
		// do something
	}
}

public class DoSomethingElseWhenSomethingHappens : IMessageHandler<SomethingHappened>{
	public void Handle(SomethingHappened message){
		// do something else
	}
}


applicationBus.Add(typeof (DoSomethingWhenSomethingHappens));
applicationBus.Add(typeof (DoSomethingElseWhenSomethingHappens));

// this message will be passed to both handlers
applicationBus.Send(new SomethingHappened());

appbus's People

Contributors

darrencauthon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

blake2002

appbus's Issues

Thread Safty

Hi,
really cool library you have here, but may i ask if it is a thread safe one ?

ASP MVC Usage

hi again,
could you please help me on how to use it in MVC? i am doing like this in Global.asax

var applicationBus = new ApplicationBus();
        applicationBus.Add(typeof(DoSomethingWhenSomethingHappens));
        applicationBus.Add(typeof(DoSomethingElseWhenSomethingHappens));

but i get this error

AppBus.ApplicationBus' does not contain a constructor that takes 0 arguments

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.