Abstractions
Namespace: RA.Utilities.Dispatcher.Abstractions
The classes within the RA.Utilities.Dispatcher.Abstractions namespace define the core interfaces for the CQRS pattern and the custom dispatcher.
✨ Purpose and Function
These interfaces form the contract between the dispatcher, your requests/notifications, and their handlers. They are the foundation upon which the Vertical Slice Architecture is built.
The primary abstractions are:
IRequest/IRequest<TResponse>: Marker interfaces for commands (no response) and queries (with response). Implement these on your request DTOs.IRequestHandler<TRequest>/IRequestHandler<TRequest, TResponse>: Interfaces your handlers implement. For a more convenient experience, inherit from the abstractRequestHandlerbase classes in theHandlersnamespace — they implement the interface plumbing so you only override oneHandleAsyncmethod.IPipelineBehavior<TRequest>/IPipelineBehavior<TRequest, TResponse>: Cross-cutting concerns that wrap request handler execution (validation, logging, etc.).INotification: Marker interface for events/notifications in the publish/subscribe system.INotificationHandler<TNotification>: Interface for notification subscribers.INotificationBehavior<TNotification>: Cross-cutting concerns that wrap notification handler execution (retry, metrics, logging).IDispatcher: The central dispatcher — sends requests and publishes notifications, returningResult-based values.IDispatcherBuilder: The shared contract behind the fluent builders in theBuildersnamespace.
🧠 Summary
In summary, the RA.Utilities.Dispatcher.Abstractions interfaces are the cornerstone of the CQRS pattern in this framework. For concrete handler implementations, see the Handlers namespace, which provides abstract base classes that handle the interface plumbing for you.
IRequest
The IRequest and IRequest marker interfaces identify your requests — the commands and queries of your CQRS application. They carry no members; their job is to give the dispatcher a compile-time contract to dispatch on.
IRequestHandler
IRequestHandler and IRequestHandler are the interfaces your request handlers implement. They define a single abstract member, HandleAsync, plus a context-aware overload with a default implementation.
IPipelineBehavior
IPipelineBehavior and IPipelineBehavior let you inject cross-cutting concerns around request handler execution — validation, logging, transaction management, caching — without touching the handlers themselves.
INotification
INotification is the marker interface for your notifications — the events of your publish/subscribe system. It carries no members; notifications are plain DTOs describing something that happened.
INotificationHandler
INotificationHandler is the interface your notification subscribers implement. Each notification can have any number of handlers; Publish runs all of them, each wrapped in its own behavior pipeline.
INotificationBehavior
INotificationBehavior lets you inject cross-cutting concerns around notification handler execution — retry, logging, metrics — per handler, independently of every other handler for the same notification.
IDispatcher
The IDispatcher interface is the central abstraction for dispatching requests and publishing notifications within your CQRS (Command Query Responsibility Segregation) architecture.
IPipeline VS INotification
How do IPipelineBehavior and INotificationBehavior
IDispatcherBuilder
IDispatcherBuilder is the shared contract behind the fluent builders in the Builders namespace. You rarely reference it directly — the concrete builders implement it.