MediatR is a .NET mediator pattern library that serves as an in-process message broker. It decouples message senders from handlers by using a central mediator to route requests, commands, and events.
The system functions as a request-response dispatcher that routes single requests to dedicated handlers and an event publisher that broadcasts notifications to multiple decoupled handlers for simultaneous processing. It also provides pipeline behavior middleware to execute shared pre- and post-processing logic across incoming messages.
The library handles in-process message dispatching and decoupled message routing, enabling request-response handling and asynchronous event broadcasting. These capabilities allow for cross-cutting pipeline logic to be applied to the communication flow.