Does Autofac support an easy to use message broker for doing many-to-many publish/subscribe event messaging?
Edit:
public class Service1
{
[Publish("message://an-event")]
public event Event<EventParams> AnEvent;
public void DoSomething()
{
// do something
// [...]
// publish message
if (AnEvent != null)
AnEvent(this, new EventParams(something))
}
}
public class Service2
{
[Subscribe("message://an-event")]
public OnAnEvent(object sender, EventParams eventParams)
{
Console.WriteLine("Hello World from Service2")
}
}
public class Service3
{
[Subscribe("message://an-event")]
public OnAnEvent(object sender, EventParams eventParams)
{
Console.WriteLine("Hello World from Service3")
}
}
The cool thing about Ninjects message broaker extension is its simplicity. You only have to add annotations to events that publish something and methods that subscribe to this event. The container handles automatically the connection. You only have to bind the services.
Has autofac something similar? If not, whats the best way to do something like this with autofac?