polymorphic message dispatch - rebus-org/Rebus GitHub Wiki

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 :)

⚠️ **GitHub.com Fallback** ⚠️