-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Anton edited this page Jul 5, 2024
·
7 revisions
The Mediator pattern consists of two main parts:
Dispatcher
Observer
Tip
Exactly one handler per request.
Returns result.
Raise HandleNotFoundError
when no handler registered for the request.
Dispatcher
- an entity that allows registering only one handler for a request.
If no handler is found for the request, a HandlerNotFoundError
error will be thrown.
Additionally, the Dispatcher
returns a result.
Tip
Many handlers per request.
No result.
Observer
- an entity that allows registering multiple handlers for a single request.
If no registered handlers are found for the request, the program will continue execution.
The Observer
does not return the execution result.
Based on the Dispatcher
, the following are built:
QueryDispatcher
CommandDispatcher
Based on the Observer
, the following are built:
EventObserver