Sponsor: Using RabbitMQ or Azure Service Bus in your .NET systems? Well, you could just use their SDKs and roll your own serialization, routing, outbox, retries, and telemetry. I mean, seriously, how hard could it be?

RequestPreProcessorBehavior<,>
and RequestPostProcessorBehavior<,>
I’ve blogged about the new behaviors before but you can do it more generically.
Cross Cutting Behavior
I was looking at the pipeline to handle cross-cutting concerns like logging and metrics, which I would want on each command/query.
— Scott Banwart (@sbanwart) September 6, 2017
Logging
Pretty typical scenario of wanting to log incoming requests. One common use case would be to store the incoming requests as a message store.Registration
The next piece of the puzzle is making sure you register theRequestPreProcessorBehavior<,>
with the DI container you are using with MediatR. In the case of StructureMap that looks like: