NxRelay is a small messaging library that provides two patterns:
- Events – a lightweight event aggregator that allows publishing messages to any number of subscribers.
- Mediator – a request/response dispatcher similar to the mediator pattern used in CQRS style applications.
Both patterns can be used independently or together. The project targets .NET 8 and contains extension methods for registering handlers with the Microsoft.Extensions.DependencyInjection container.
The repository contains a Visual Studio solution and can be built with the .NET SDK:
dotnet buildUnit tests are written with NUnit. Run them using:
dotnet testRegister messaging services in your application startup:
var services = new ServiceCollection();
// Optionally pass assemblies that contain your handlers
services.AddMessaging(typeof(MyHandler).Assembly);Inject Events or IMediator where needed and register handlers or publish messages.
This project is licensed under the MIT License. See the LICENSE file for details.