Chapter.Net.Mediation provides an implementation of the mediator pattern in the form of a sync and async message bus.
- Send messages anonymously synchronously: The IMessageBus can send and receive messages around synchronously.
- Send messages anonymously asynchronously: The IMessageBus can send and receive messages around asynchronously.
-
Installation:
- Install the Chapter.Net.Mediation library via NuGet Package Manager:
dotnet add package Chapter.Net.Mediation
-
Synchronously:
- Send
_messageBus.Publish(new NotificationOne());
- Receive
_token = _messageBus.Subscribe<NotificationOne>(Callback); _token.Dispose();
-
Asynchronously:
- Send
await _messageBus.PublishAsync(new NotificationOne());
- Receive
_token = _messageBus.Subscribe<NotificationOne>(Callback); _token.Dispose();
Copyright (c) David Wendland. All rights reserved. Licensed under the MIT License. See LICENSE file in the project root for full license information.