EventFlux.RabbitFlow 1.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package EventFlux.RabbitFlow --version 1.0.2
                    
NuGet\Install-Package EventFlux.RabbitFlow -Version 1.0.2
                    
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="EventFlux.RabbitFlow" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="EventFlux.RabbitFlow" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="EventFlux.RabbitFlow" />
                    
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 EventFlux.RabbitFlow --version 1.0.2
                    
#r "nuget: EventFlux.RabbitFlow, 1.0.2"
                    
#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.
#:package EventFlux.RabbitFlow@1.0.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=EventFlux.RabbitFlow&version=1.0.2
                    
Install as a Cake Addin
#tool nuget:?package=EventFlux.RabbitFlow&version=1.0.2
                    
Install as a Cake Tool

EventFlux.RabbitFlow

EventFlux.RabbitFlow is a lightweight event-driven library that integrates with RabbitMQ, providing an efficient way to handle event-based messaging in .NET applications.

Features

  • Seamless integration with RabbitMQ
  • Supports event-driven CQRS patterns
  • Easy event publishing and subscription
  • Automatic dependency injection support
  • Simple conventions for event handlers

Requirements

  • .NET 6.0 or later (library targets modern .NET; check project file for exact target)
  • RabbitMQ broker reachable from your application

Installation

Install the package from NuGet:

Install-Package EventFlux.RabbitFlow

or with the .NET CLI:

dotnet add package EventFlux.RabbitFlow

Quick Start

  1. Define an event

Create an event that implements IEventRequest:

public class ExampleEventRequest : IEventRequest
{
	public string Str { get; set; }
}
  1. Create an event handler

Implement the IEventHandler<T> interface to handle the event:

public class ExampleEventRequestHandler : IEventHandler<ExampleEventRequest>
{
	public async Task Handle(ExampleEventRequest @event)
	{
		Console.WriteLine("Consume data: " + @event.Str);
		await Task.CompletedTask;
	}
}
  1. Configure Dependency Injection

Register the library and RabbitMQ connection in Program.cs. The library exposes an extension method AddEventFluxRabbitFlow that scans assemblies for handlers and configures the required services. Example:

builder.Services.AddEventFluxRabbitFlow(
	typeof(Program).Assembly,
	new ConnectionFactory() { Uri = new Uri("amqp://guest:guest@localhost:5672") },
	"publisher_queue"
);
  1. Subscribe to events

Resolve the IEventBroker and subscribe to events (typically done as part of your application startup):

var _sp = builder.Services.BuildServiceProvider();
var _eventBus = _sp.GetRequiredService<EventFlux.RabbitFlow.Abstractions.IEventBroker>();
await _eventBus.SubscribeAsync<ExampleEventRequest, ExampleEventRequestHandler>();
  1. Publish an event

In your API controller or service, publish an event:

[HttpPost]
public async Task<IActionResult> Post()
{
	ExampleEventRequest @event = new ExampleEventRequest { Str = "Hello World" };
	await _eventBus.PublishAsync(@event);
	return Ok();
}

Configuration

  • Connection settings are provided via RabbitMQ.Client.ConnectionFactory when calling AddEventFluxRabbitFlow.
  • You can customize queue names, routing, and other behavior by extending the provided abstractions such as IPersistenceConnection and IEventBusSubscriptionsManager.

Exchange Support

The library uses a default exchange name derived from the configured service name. You can also publish and subscribe to events using a different exchange by passing an exchange name to the provided overloads.

  • Default exchange: when you register the library with a serviceName (the third parameter in AddEventFluxRabbitFlow), that name is used as the default exchange.
  • Custom exchange: call the overloads that accept an exchangeName to publish or subscribe on a different exchange.

Examples:

Publish to a custom exchange:

// publish to the default exchange
await _eventBus.PublishAsync(@event);

// publish to a custom exchange named "eventbus_flow_2"
await _eventBus.PublishAsync(@event, "eventbus_flow_2");

Subscribe to events on a custom exchange:

// subscribe using default exchange
await _eventBus.SubscribeAsync<ExampleEventRequest, ExampleEventRequestHandler>();

// subscribe to the same event on a specific exchange
await _eventBus.SubscribeAsync<ExampleEventRequest, ExampleEventRequestHandler>("eventbus_flow_2");

Project layout

  • EventBusRabbitMQ.cs — core RabbitMQ integration and publish/subscribe orchestration
  • EventBusSubscriptionsManager.cs — manages in-memory mapping between events and handlers
  • PersistenceConnection.cs — manages RabbitMQ connection lifecycle
  • RabbitFlowExtensions.cs — DI registration and extension methods
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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 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
1.0.3 122 12/20/2025
1.0.2 686 12/2/2025
1.0.1 564 3/25/2025