MinimalRabbit 0.0.16-alpha

This is a prerelease version of MinimalRabbit.
dotnet add package MinimalRabbit --version 0.0.16-alpha
                    
NuGet\Install-Package MinimalRabbit -Version 0.0.16-alpha
                    
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="MinimalRabbit" Version="0.0.16-alpha" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MinimalRabbit" Version="0.0.16-alpha" />
                    
Directory.Packages.props
<PackageReference Include="MinimalRabbit" />
                    
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 MinimalRabbit --version 0.0.16-alpha
                    
#r "nuget: MinimalRabbit, 0.0.16-alpha"
                    
#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 MinimalRabbit@0.0.16-alpha
                    
#: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=MinimalRabbit&version=0.0.16-alpha&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=MinimalRabbit&version=0.0.16-alpha&prerelease
                    
Install as a Cake Tool

MinimalRabbit

A .NET source generator that reduces the boilerplate for RabbitMQ queues, consumers, and publishers. Declare queues and consumers with attributes; generated registrations wire them into your app.

1. Your first queue

Declare a message, its queue, and a consumer. The source generator supplies the queue contract and consumer plumbing.

using MinimalRabbit;

public sealed record HelloMessage(string Text);

[Queue<HelloMessage>("hello")]
public partial class HelloQueue { }

[Consumer<HelloQueue>]
public partial class HelloConsumer
{
	public partial Task ExecuteAsync(HelloMessage message)
	{
		Console.WriteLine(message.Text);
		return Task.CompletedTask;
	}
}

The Queue and Consumer attributes generate all the boilerplate needed for a queue to be set up inside RabbitMQ and the ExecuteAsync function now listens for incoming messages.

2. Get started

Install the package:

dotnet add package MinimalRabbit

Configure the RabbitMQ connection in appsettings.json:

{
  "Rabbit": {
	"Host": "localhost",
	"Port": 5672,
	"Username": "your-username",
	"Password": "your-password"
  }
}

Keep credentials in .NET user secrets or environment variables, not source control.

Register generated consumers and publishers, then run the host:

using MinimalRabbit;

MinimalRabbitBuilder builder = MinimalRabbitBuilder.CreateDefault();
builder.ConfigureRabbitMq();
builder.MapAllConsumers();
builder.AddAllPublishersToServices();

MinimalRabbitApp app = builder.Build();
await app.RunAsync();

Add a generated publisher by declaring a partial PublishAsync method:

using MinimalRabbit;
using System.Threading.Tasks;

public partial class HelloPublisher
{
	[Publisher<HelloQueue>]
	public partial Task PublishAsync(HelloMessage message);
}

3. More features

Queue options and dependency injection

Queue settings such as Durable, Exclusive, AutoDelete, Passive, NoWait, and Arguments are generated (durable defaults to true; exclusive and auto-delete to false) and can be set in the queue constructor. Consumers can receive services through constructor injection. Publisher ConfigurePublish methods can change the default Mandatory and Persistent settings (both true). To add publishers to an existing IHostApplicationBuilder, use ConfigureRabbitMq() and AddAllPublishersToServices(); consumers use the standalone MinimalRabbit host.

Forward a consumer result

[PublishTo<TQueue>] publishes a consumer's returned message to another queue after successful processing:

[Consumer<IncomingQueue>]
[PublishTo<ProcessedQueue>]
public partial class ProcessConsumer
{
	public partial Task<ProcessedMessage> ExecuteAsync(InputMessage message)
		=> Task.FromResult(new ProcessedMessage(message.Id));
}

Fan-out and fan-in

  • [FanOut(typeof(WorkQueue), typeof(EmailQueue))] sends different message types to multiple queues.
  • [StructuralFanOut(typeof(QueueA), typeof(QueueB))] sends the same message type and result to multiple queues.
  • [ParametricFanOut<WorkQueue>] sends a runtime-sized collection of messages to one queue.
  • [FanIn] waits for an operation's work items to complete. It is a completion barrier, not a result aggregator.

Fan operations need persistence. The in-memory option does not survive process restarts; the optional file-based package is single-process.

Fan graph analysis and Mermaid charts

The source generator analyzes declared fan-out routes and reports warnings MR0017/MR0018 when branches will be orphaned and do not converge on the same [FanIn] consumer. It also generates a workflow graph that can be rendered as a Mermaid flowchart:

using System.IO;

string markdown = MinimalRabbit.Generated.MyAppWorkflowGraph.ToMarkdown(options =>
{
	options.ChartName = "Order workflow";
	options.ShowQueueNames = true;
	options.ShowConsumerClassNames = true;
	options.ShowCategories = true;
	options.ShowDescriptions = true;
});

File.WriteAllText("workflow.md", markdown);

Replace MyApp with your assembly name (non-identifier characters are replaced with underscores). Consumer categories and descriptions can be set with [Category] and [Description] attributes.

4. Manual consumer registration

(Not Recommended)

For cases where you do not want the [Consumer] attribute, register the handler directly. This reuses HelloQueue and HelloMessage from the first example; the queue type needs to be registered with dependency injection:

using System;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using MinimalRabbit;

MinimalRabbitBuilder builder = MinimalRabbitBuilder.CreateDefault();
builder.ConfigureRabbitMq();
builder.Services.AddSingleton<HelloQueue>();
builder.Consume<HelloQueue, HelloMessage>(context =>
{
	Console.WriteLine(context.Message.Text);
	return Task.CompletedTask;
});

MinimalRabbitApp app = builder.Build();
await app.RunAsync();

This manual setup replaces MapAllConsumers() for that handler. For upgrade notes, see the breaking changes guide.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 was computed.  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.  net10.0 is compatible.  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.  net11.0 is compatible. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on MinimalRabbit:

Package Downloads
MinimalRabbit.FanOperations.FileBased

Add fan operations to MinimalRabbit. This package adds fan operations that are saved on the file system.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.16-alpha 50 11/29/2026
0.0.15-alpha 64 11/21/2026
0.0.14-alpha 66 11/21/2026
0.0.13-alpha 59 11/21/2026
0.0.12-alpha 64 11/17/2026
0.0.11-alpha 62 11/14/2026
0.0.10-alpha 79 10/12/2026
0.0.9-alpha 77 10/2/2026
0.0.8-alpha 83 9/20/2026
0.0.7-alpha 77 9/17/2026
0.0.6-alpha 72 9/17/2026
0.0.5-alpha 102 9/11/2026
0.0.4-alpha 88 9/11/2026
0.0.3-alpha 108 9/8/2026
0.0.2-alpha 93 9/7/2026
0.0.1-alpha 132 9/7/2026

Placeholder file