Event handler logic

71 views
Skip to first unread message

Rod Johnson

unread,
Jul 22, 2011, 12:51:30 PM7/22/11
to DDD/CQRS
I'm trying to build a .NET website using CQRS and have found a few
different ways of event handling

NOTE: I am a beginner with CQRS and messaging in general

Scenario 1:

create an eventhandlers project that has all the event handlers you
would need for a system, for this i think they best approach is a 1:1
events to event handlers. the Event handlers project will then add a
dependency to every service that cares about this particular event
handler. Thus the services are they decoupled from the events,

I think this would lead to a maintenance nightmare.

Scenario 2:

each party that cares about the events will reference the "Events"
library and implement some interface on that library IHandleEvent or
something.


Questions:
Eventually I would like to just listen for events to get published to
some service bus and only reference that... and maybe a lightweight
events library, correct? How does this work with dependency
injection... Where do the event handler classes get their IOC
container from? Do they have to be hosted in their own app domain for
this to happen?

thang chung

unread,
Jul 25, 2011, 4:42:29 AM7/25/11
to ddd...@googlegroups.com
Your approach 2 is good. I think you can use NCRQS for easy to manage your code rather than write it from scratch.
--
==========================================================
Regards,
ThangChung,
http://weblogs.asp.net/thangchung
Reply all
Reply to author
Forward
0 new messages