This page summarizes the current and planned capabilities for the Mediator
library. This roadmap focuses on high-signal planning items and provides visibility into the evolution of the mediator pattern implementation.
Legend β
Implemented Β· π In Progress Β· β High Priority (next 1β2 milestones) Β· π Planned Β· π€ Considering
Phase Overview Foundation (β
complete) Core Request/Event Handling (β
complete) Pipeline Behaviors & Orchestration (β
complete) Source Generation & DI Integration (β
complete) Advanced Event Patterns (π outbox refinement, distributed events) Performance & Scalability (β streaming, batching, caching) Observability & Diagnostics (π tracing, metrics, debugging) Resilience & Error Recovery (π retry policies, circuit breakers) Advanced Composition (π saga patterns, distributed transactions) Tooling & Developer Experience (π analyzers, testing utilities) Recently Completed Highlights Request/response pattern with ISender
returning Result<TResponse>
or Result
Event publishing with IPublisher
supporting multiple handlers per event Pipeline behaviors for both requests (IRequestPipelineBehavior
) and events (IEventPipelineBehavior
) Event orchestration: Sequential and Concurrent execution strategies Outbox pattern support with IEventOutboxStorage
and PublishMode
enum Source generation with MediatorGenerator
for automatic handler registration Context propagation with IContext
and IContextFactory
Integration with Result type for functional error handling Active / Next (Short Horizon) Item Status Notes Outbox pattern improvements β Retry logic, dead-letter queue, batch processing Request pipeline behaviors enhancement β Generic typed behaviors, conditional execution Context enrichment π Metadata helpers, correlation ID propagation Handler result aggregation strategies π Custom combiners for multi-handler event results Notification vs Command clarification π Explicit abstractions for one-way notifications
Event Publishing & Orchestration Item Status Goal Sequential orchestrator β
Execute handlers in order Concurrent orchestrator β
Execute handlers in parallel Custom orchestration strategies β Priority-based, conditional, throttled execution Event filtering π Handler selection based on runtime criteria Event versioning π Support multiple versions of same event type Distributed event bus π Integration with message brokers (RabbitMQ, Azure SB) Event replay π€ Reprocess events from outbox/event store
Request Handling Enhancements Feature Status Purpose Request/response with Result β
Functional error handling Request without response β
Command pattern support Streaming requests β IAsyncEnumerable support for large datasets Request validation behavior β Built-in validation pipeline behavior Request caching behavior π Automatic response caching with invalidation Request deduplication π Prevent duplicate request processing Request timeout behavior π Automatic timeout enforcement Multi-handler requests π€ Support multiple handlers for single request (scatter)
Pipeline Behaviors Feature Status Purpose Request pipeline behaviors β
Cross-cutting concerns for requests Event pipeline behaviors β
Cross-cutting concerns for events Simple logging behavior β
Built-in logging example Typed behaviors β Behaviors specific to request/event types Conditional behavior execution β Execute behaviors based on context or metadata Behavior ordering π Explicit control over behavior execution order Behavior composition π Combine multiple behaviors into reusable pipelines Performance monitoring behavior π Track execution time and resource usage Exception handling behavior π Centralized exception mapping to Result errors
Outbox Pattern & Reliability Feature Status Purpose In-memory outbox storage β
Development and testing Publish modes (Now/Outbox) β
Control event delivery timing CommitAsync for batch send β
Process all pending events Persistent outbox storage β EF Core, Dapper implementations Outbox retry policies β Exponential backoff, max attempts Dead-letter queue β Failed event handling Outbox batch processing π Process multiple events efficiently Outbox cleanup π Remove processed events after retention period Outbox monitoring π Track pending, failed, processed event counts Idempotency support π Prevent duplicate event processing
Source Generation & DI Feature Status Purpose RequestHandler attribute β
Mark classes for auto-registration EventHandler attribute β
Mark classes for auto-registration IRegisterGroup interface generation β
Type-safe DI registration Handler discovery β
Automatic handler detection Scoped vs singleton detection π Infer or specify handler lifetimes Multiple assemblies support π Scan handlers across multiple projects Conditional registration π€ Register handlers based on build configuration
Feature Status Purpose ValueTask usage β
Reduce allocations for synchronous completions Handler result caching π Cache expensive request results Request batching π Group similar requests for efficiency Streaming support β Handle large datasets with IAsyncEnumerable Memory pooling π Reuse buffers for event/request processing Parallel event dispatching β
Concurrent orchestrator Rate limiting behavior π Throttle request/event processing Backpressure handling π€ Manage event queue overflow
Observability & Diagnostics Feature Status Purpose Context correlation ID β
Track requests across boundaries OpenTelemetry integration β Distributed tracing and metrics Request/event logging behavior β
Simple logging example included Performance metrics π Track handler execution time, success rates Handler execution visualization π Debug complex pipelines and behaviors Diagnostic source integration π .NET diagnostic infrastructure support Health checks π Monitor mediator and handler health Debugger display attributes π Rich debugging experience
Resilience & Error Recovery Feature Status Purpose Result-based error handling β
Functional error propagation Retry behavior β Automatic retry with configurable policies Circuit breaker behavior β Prevent cascading failures Fallback behavior π Provide default responses on failure Timeout behavior π Enforce maximum execution time Bulkhead isolation π Isolate handler failures Compensating actions π€ Saga pattern support for distributed transactions
Advanced Patterns Feature Status Purpose Request transformation π Map one request type to another Request aggregation π Combine multiple requests into one Event sourcing support π€ Store events as source of truth CQRS helpers π Separate command and query infrastructures Saga orchestration π€ Long-running business processes Request/event versioning π Handle multiple versions of messages Content-based routing π€ Route to handlers based on message content
Testing & Developer Experience Feature Status Purpose In-memory testing utilities π Test handlers without infrastructure Mock mediator π Test components using mediator Behavior testing helpers π Test pipeline behaviors in isolation Request/event builders π Fluent API for test data creation Analyzer: missing handler β Warn when no handler registered Analyzer: multiple handlers π Warn about unexpected multiple registrations Analyzer: async void handlers β Prevent common async mistakes Code snippets π VS/Rider snippets for common patterns Migration guides π From MediatR and other libraries
Integration & Interop Feature Status Purpose ASP.NET Core integration β Endpoint filters, minimal APIs Native AOT compatibility β
Optimized for ahead-of-time compilation Dependency injection support β
Microsoft.Extensions.DependencyInjection Other DI containers π Autofac, Simple Injector support gRPC integration π Use mediator in gRPC services SignalR integration π Publish events to connected clients Azure Functions support π Use mediator in serverless functions Message broker adapters π Publish events to external systems
Design Tenets Result-based error handling for explicit success/failure Native AOT compatibility for optimal performance Source generation for zero-reflection handler registration Pipeline behaviors for cross-cutting concerns Flexible event orchestration strategies Outbox pattern for reliable event delivery Context propagation for correlation and tracing Composability and extensibility at every level Open Questions (Tracking) Should we support multiple handlers per request (scatter-gather pattern) or enforce single handler? Whatβs the best approach for handler lifetime management in source generation vs manual registration? Should pipeline behaviors have explicit ordering or rely on registration order? How deep should we integrate with observability frameworks (OpenTelemetry, Application Insights)? Should we provide built-in validation behavior or leave it to users/separate packages? Outbox pattern: should we support multiple storage backends out-of-the-box or provide interfaces only? How to handle versioning of events/requests in a breaking-change scenario? Contributing Issues / PRs welcome. When proposing a new feature, outline:
Category (Request Handling / Event Publishing / Pipeline / Orchestration / Integration) Use case and benefits Breaking changes or compatibility concerns Performance implications Integration with existing features Testing strategy UnambitiousFx.Mediator differentiates itself through:
Result-based APIs : First-class Result support for functional error handling Native AOT : Optimized for ahead-of-time compilation with source generation Event orchestration : Built-in concurrent and sequential strategies Outbox pattern : First-class support for reliable event delivery Modern C# : Leverages latest C# features (ValueTask, readonly structs, etc.) Migration guide from MediatR: Coming soon π
Last updated: 2025-10-02