LightMediator 0.2.0
LightMediator
LightMediator is a lightweight library designed to simplify decoupled communication in distributed Windows services. It works with multiple notification types and supports services across different namespaces.
Features
- Lightweight and efficient.
- Supports publish-subscribe, request-response, and one-way notifications.
- Simplifies working with decoupled services in distributed systems.
- Easy to integrate with existing applications.
Installation
You can install the LightMediator NuGet package using the following command:
dotnet add package LightMediator
Usage
Publish Notifications
You can publish notifications to subscribers using the LightMediator instance:
var mediator = new LightMediator();
mediator.Publish(new Notification("ServiceStarted"));
Handle Notifications
To handle notifications, create a class that implements the INotificationHandler<T> interface. Ensure that Notification implements the INotification interface:
public class Notification : INotification
{
public string Message { get; }
public Notification(string message)
{
Message = message;
}
}
public class NotificationHandler : INotificationHandler<Notification>
{
public Task Handle(Notification notification, CancellationToken cancellationToken)
{
Console.WriteLine($"Received: {notification.Message}");
return Task.CompletedTask;
}
}
License
This project is licensed under the MIT License. See the LICENSE file for details.
No packages depend on LightMediator.
- Add option for full notification name mapping
.NET 8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 9.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 9.0.1)
- Newtonsoft.Json (>= 13.0.3)
| Version | Downloads | Last updated |
|---|---|---|
| 1.0.0 | 3 | 12/13/2025 |
| 0.5.2 | 1 | 12/13/2025 |
| 0.5.1.4 | 1 | 12/13/2025 |
| 0.5.1.3 | 1 | 12/13/2025 |
| 0.5.1.2 | 1 | 12/13/2025 |
| 0.5.1.1 | 1 | 12/13/2025 |
| 0.5.1 | 1 | 12/13/2025 |
| 0.5.0 | 1 | 12/13/2025 |
| 0.4.8 | 1 | 12/13/2025 |
| 0.4.7 | 1 | 12/13/2025 |
| 0.4.6 | 1 | 12/13/2025 |
| 0.4.5 | 1 | 12/13/2025 |
| 0.4.4 | 1 | 12/13/2025 |
| 0.4.3 | 1 | 12/13/2025 |
| 0.4.2 | 1 | 12/13/2025 |
| 0.4.1 | 1 | 12/13/2025 |
| 0.4.0 | 1 | 12/13/2025 |
| 0.3.0 | 1 | 12/13/2025 |
| 0.2.0 | 1 | 12/13/2025 |
| 0.1.0 | 1 | 12/13/2025 |