Mediator Enhancments - #181
Merged
Merged
Conversation
Introduce INotificationPipelineBehavior<TNotification> for notifications, enabling middleware-style behaviors (e.g., logging, error handling) around notification handlers. Update MediatorOptions and DI registration to support open and closed notification behaviors. Refactor PublishAsync to execute handlers through the pipeline. Add LoggingNotificationBehavior example and comprehensive tests for pipeline execution and integration. Brings notification handling in line with command/query pipelines.
Introduced exception handling pipeline behaviors for commands, queries, and notifications, including ExceptionHandlingCommandBehavior, ExceptionHandlingVoidCommandBehavior, ExceptionHandlingQueryBehavior, and ExceptionHandlingNotificationBehavior. Added IExceptionHandler and IExceptionHandler<TResult> interfaces for custom exception handling and fallback results. Provided default handlers, DI registration extensions, and comprehensive unit/integration tests. Updated README with usage, configuration, and code samples.
…and tests Introduces a caching pipeline behavior for queries, supporting both the [Cacheable] attribute and ICacheableQuery interface for flexible cache control. Adds ICacheKeyGenerator (with default implementation) for cache key generation and ICacheInvalidator for manual cache invalidation. Provides CachingOptions for configuration and DI extensions for easy setup. Updates README with usage docs and adds comprehensive unit/integration tests. Project files updated to include required caching packages.
Introduces IStreamQuery, streaming handlers, and pipeline behaviors for efficient IAsyncEnumerable-based queries. Adds built-in logging behavior, DI registration, and new IMediator streaming APIs. Includes docs and comprehensive tests for streaming, pipeline, and cancellation scenarios.
…iator Introduces IRequestPreProcessor and IRequestPostProcessor interfaces for running logic before and after handlers, supporting both commands/queries with and without responses. Implements corresponding pipeline behaviors for commands, queries, and notifications. Updates DI extensions for automatic processor registration and adds `.AddProcessorBehaviors()` to options. Enhances documentation with usage examples and adds comprehensive unit and integration tests. This is a non-breaking, opt-in addition.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v3/feature/#175: Introduce INotificationPipelineBehavior for notifications, enabling middleware-style behaviors (e.g., logging, error handling) around notification handlers. Update MediatorOptions and DI registration to support open and closed notification behaviors. Refactor PublishAsync to execute handlers through the pipeline. Add LoggingNotificationBehavior example and comprehensive tests for pipeline execution and integration. Brings notification handling in line with command/query pipelines.