Using an Event Aggregator from StoryTeller

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…

Advertisements

Tags:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: