Reputation: 207
I have a request which contains some information about order.
I have Rule sets for orders. When I send this request It should handle by all rule handlers and return results. All handlers get same request object.
Can I send register multiple request handlers for mediatr ?
(I can't use notifications. They are fire forget. And I need return result)
Upvotes: 2
Views: 13038
Reputation: 14034
Can I send register multiple request handlers for mediatr?
No. From the docs:
MediatR has two kinds of messages it dispatches:
- Request/response messages, dispatched to a single handler
- Notification messages, dispatched to multiple handlers
This is by design.
Send = Tell someone a message (command)
Publish = Tell the world something happened (event)
Since mediatr works in-process, Requests (Send()
) can also return a response.
And again, since mediatr works in-process, Publish()
is not fire-and-forget (not by default at least).
Upvotes: 5