Arley Pádua
1 min readSep 19, 2019

--

I don’t think you’re correct in your statement.

In the documentation it says:

MediatR has two kinds of messages it dispatches:

  • Request/response messages, dispatched to a single handler.
  • Notification messages, dispatched to multiple handlers.

https://github.com/jbogard/MediatR/wiki#basics

Notification messages are handled by one or more handlers and a command, by definition will always be consumed by a single handler.

Therefore, in MediatR request/response messages are intended for commands and notification messages are widely used for events in general.

What could be done in this case is to inherit from AsyncRequestHandler (which internally returns a Unit and exposes a method that returns a Task) instead of implement the interface IRequestHandler.

--

--

Arley Pádua
Arley Pádua

Written by Arley Pádua

Software Engineer and passionate about distributed systems

Responses (1)