LightMediator 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package LightMediator --version 0.1.0                
NuGet\Install-Package LightMediator -Version 0.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LightMediator" Version="0.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LightMediator --version 0.1.0                
#r "nuget: LightMediator, 0.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LightMediator as a Cake Addin
#addin nuget:?package=LightMediator&version=0.1.0

// Install LightMediator as a Cake Tool
#tool nuget:?package=LightMediator&version=0.1.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.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.4.2 100 2/3/2025
0.4.1 72 2/3/2025
0.4.0 83 2/2/2025
0.3.0 60 1/25/2025
0.2.0 34 1/24/2025
0.1.0 30 1/24/2025

- Initial release of LightMediator
- Lightweight and fast for Windows services
- Supports multiple notification types
- Simplifies decoupled communication