LightMediator.EventBus.RabbitMQ 0.5.1.12

dotnet add package LightMediator.EventBus.RabbitMQ --version 0.5.1.12
                    
NuGet\Install-Package LightMediator.EventBus.RabbitMQ -Version 0.5.1.12
                    
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.EventBus.RabbitMQ" Version="0.5.1.12" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LightMediator.EventBus.RabbitMQ" Version="0.5.1.12" />
                    
Directory.Packages.props
<PackageReference Include="LightMediator.EventBus.RabbitMQ" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LightMediator.EventBus.RabbitMQ --version 0.5.1.12
                    
#r "nuget: LightMediator.EventBus.RabbitMQ, 0.5.1.12"
                    
#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.
#addin nuget:?package=LightMediator.EventBus.RabbitMQ&version=0.5.1.12
                    
Install as a Cake Addin
#tool nuget:?package=LightMediator.EventBus.RabbitMQ&version=0.5.1.12
                    
Install as a Cake Tool

LightMediator.EventBus.RabbitMQ

NuGet License: MIT

LightMediator.EventBus.RabbitMQ is an extension for LightMediator and LightMediator.EventBus that adds distributed messaging support using RabbitMQ.

It enables publishing and subscribing to INotification messages between services, applications, or domains in a decoupled and scalable way — powered by RabbitMQ and your high-performance, lightweight mediator.

✨ Features

  • 🔄 Publish/Subscribe model over RabbitMQ.
  • 💡 Built on top of LightMediator.EventBus.
  • 🔌 Easy integration with minimal configuration.
  • 🔒 Supports durable queues and automatic reconnects.

📦 Installation

Install via NuGet:

dotnet add package LightMediator.EventBus.RabbitMQ

Or via the Package Manager:

Install-Package LightMediator.EventBus.RabbitMQ

🚀 Getting Started

1. Register LightMediator with RabbitMQ support

In your Program.cs or Startup.cs:

builder.Services.AddLightMediator(options =>
{
    options.IgnoreNamespaceInAssemblies = true;
    options.IgnoreNotificationDifferences = true;
    options.RegisterNotificationsByAssembly = true;
    options.RegisterRequestsByAssembly = true;

    options.Assemblies = new[]
    {
        Assembly.GetExecutingAssembly(),
        Lib1.GetServiceAssembly(),
        Lib2.GetServiceAssembly(),
        Service1.GetServiceAssembly()
    };

    options.AddLightMediatorEventBus(services)
           .UseRabbitMQ(new RabbitMQSettings()
             {
                 HostUri = "rabbitmq://localhost",
                 Username = "guest",
                 Password = "guestpassword"
             };
});

2. Create a Notification

using LightMediator;

namespace WorkerService1.Events;

internal class TestEvent:INotification
{
    public string MyProperty { get; set; }
}

3. Handle the Notification in another service

using LightMediator;
using WorkerService2.Events;

namespace WorkerService2.EventHandlers;

internal class TestEventHandler : NotificationHandler<TestEvent>
{
    private readonly ILogger<TestEventHandler> _logger;

    public TestEventHandler(ILogger<TestEventHandler> logger)
    {
        _logger = logger;
    }

    public override Task Handle(TestEvent message, CancellationToken? cancellationToken)
    {
        _logger.LogInformation($"___________________Event recieved__________________ {message.MyProperty}");
        return Task.CompletedTask;
    }
}

4. Publish a Notification as a Event using eventbus extension method

 await _mediator.PublishEvent(new TestEvent() { MyProperty = "Hello"});

The message will be delivered to all services that registered the same ExchangeName and are listening for that notification.

📝 License

This project is licensed under the MIT License.


Created with ❤️ by @omidmloo

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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.5.1.12 78 5/23/2025
0.5.1.11 83 5/23/2025
0.5.1.10 131 5/23/2025
0.5.1 141 5/19/2025

- fix rabbit mq fanout multi queue
- fix reference package versioning