Behaviors
Namespace: RA.Utilities.Dispatcher.Behaviors
RA.Utilities.Dispatcher.Behaviors provides built-in IPipelineBehavior and INotificationBehavior implementations for common cross-cutting concerns.
📦 Request Pipeline Behaviors
| Behavior | Interface | Purpose |
|---|---|---|
LoggingBehavior<TRequest> | IPipelineBehavior<TRequest> | Logs each request and its result |
LoggingBehavior<TRequest, TResponse> | IPipelineBehavior<TRequest, TResponse> | Logs each request and its response |
ValidationBehavior<TRequest> | IPipelineBehavior<TRequest> | Validates requests via FluentValidation; returns a failed Result containing a BadRequestException on invalid requests |
ValidationBehavior<TRequest, TResponse> | IPipelineBehavior<TRequest, TResponse> | Validates requests via FluentValidation; returns a failed Result containing a BadRequestException on invalid requests |
📬 Notification Pipeline Behaviors
| Behavior | Interface | Purpose |
|---|---|---|
NotificationLoggingBehavior<TNotification> | INotificationBehavior<TNotification> | Logs notification handling start and finish |
NotificationMetricsBehavior<TNotification> | INotificationBehavior<TNotification> | Measures handler duration; warns if over 500 ms |
NotificationRetryBehavior<TNotification> | INotificationBehavior<TNotification> | Retries failed handlers with configurable backoff |
LoggingBehavior
LoggingBehavior is a pipeline behavior that logs each request and its outcome. It comes in two variants — one for requests with a response and one for requests without.
ValidationBehavior
ValidationBehavior is a pipeline behavior that runs all registered FluentValidation validators against the incoming request before the handler executes. Invalid requests never reach your business logic — the behavior short-circuits the pipeline and returns a failed result.
NotificationLoggingBehavior
NotificationLoggingBehavior is a notification behavior that logs each notification handler invocation at start and finish.
NotificationMetricsBehavior
NotificationMetricsBehavior is a notification behavior that measures how long each notification handler takes and warns on slow handlers.
NotificationRetryBehavior
NotificationRetryBehavior is a notification behavior that retries a handler when it returns a failed result, with an incremental backoff.