forked from rebus-org/Rebus
-
Notifications
You must be signed in to change notification settings - Fork 0
Polymorphic message dispatch
mookid8000 edited this page Dec 28, 2012
·
2 revisions
Polymorphic message dispatch consists of doing multiple handler lookups for each incoming message - i.e. for each incoming message, a handler pipeline will be made, consisting of all handlers that handle the specified message including handlers that handle any superclass of the message and handlers that handle an interface implemented by the message.
For example this event:
public class SomeCompositeEvent : ISomethingHappened, ISomethingElseHappened { ... }
that clearly consists of the composition of two discrete events, ISomethingHappened
and ISomethingElseHappened
. Dispatching SomeCompositeEvent
will thus result in dispatching to handlers that implement the following interfaces:
IHandleMessages<SomeCompositeEvent>
IHandleMessages<ISomeHappened>
IHandleMessages<ISomethingElseHappened>
IHandleMessages<object>
Yea, that's right: If a handler implements IHandleMessages<object>
, it will get all messages :)