IMessageBrokerinterface and by the default
MessageBrokerimplementation found in the Radical assembly.
The broker itself has a dependency on the
IDispatchercan be seen as a wrapper of the current
SynchronizationContext. We wrap it in a
IDispatcherinstance to avoid coupling the broker to a specific implementation.
In the above sample we are using a default
NullDispatcherthat does nothing and is a good choice for console or web applications where marshaling calls in the main thread is not mandatory. Radical.Windows comes with a built-in
Broadcastmethod, broadcasted messages will be delivered to subscribers asynchronously, and in parallel, thus the subscriber is invoked on a thread that is not the same as the publisher.
Dispatchmethod that guarantees that all the subscribers are invoked on the same thread of the publisher in a serial manner.
InvocationModelenumeration we can specify that we, as subscribers, need the subscription to be invoked on the main UI thread.