Archive for the ‘EDA’ Category

Using an Event Aggregator from StoryTeller

August 12, 2009

The StoryTeller aggregator utilizes two ways to get published events to the listeners. The first requires creating listeners that implement an

    public interface IListener<T>

    {

        void Handle(T message);

    }

 
Publishing events requires using

void SendMessage<T>(T message);

 
Setting up an event handler (listeners is pretty easy. Just implement the interface for the class. If you are using ReSharper, You get code generation for free.

The second way is to supply a specific listener object when you send a message. I removed this method from the aggregator because it would not allow me to use an Action<T> signature message.

I extracted the event aggregator from StoryTeller to use as the messaging system for my new application. Since I didn’t have that much experience with this type of pattern, I needed some feedback for the application.

The feedback that I was interested in was the wiring of the events and there cascading effects when the events are activated. Pretty much this creates an event workflow.

The events used in the aggregator are push events. You load the event with data then publish the event. The events initially seem to be weak, There isn’t much to them except for the classes them selves.

More still to come…