MVFC.Aspire.Helpers.RabbitMQ 6.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package MVFC.Aspire.Helpers.RabbitMQ --version 6.4.0
                    
NuGet\Install-Package MVFC.Aspire.Helpers.RabbitMQ -Version 6.4.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="MVFC.Aspire.Helpers.RabbitMQ" Version="6.4.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MVFC.Aspire.Helpers.RabbitMQ" Version="6.4.0" />
                    
Directory.Packages.props
<PackageReference Include="MVFC.Aspire.Helpers.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 MVFC.Aspire.Helpers.RabbitMQ --version 6.4.0
                    
#r "nuget: MVFC.Aspire.Helpers.RabbitMQ, 6.4.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.
#:package MVFC.Aspire.Helpers.RabbitMQ@6.4.0
                    
#: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=MVFC.Aspire.Helpers.RabbitMQ&version=6.4.0
                    
Install as a Cake Addin
#tool nuget:?package=MVFC.Aspire.Helpers.RabbitMQ&version=6.4.0
                    
Install as a Cake Tool

MVFC.Aspire.Helpers.RabbitMQ

🇧🇷 Leia em Português

Helper for integrating with RabbitMQ in .NET Aspire projects, including automatic creation of exchanges, queues, and dead letter queues.

Overview

MVFC.Aspire.Helpers.RabbitMQ is an extension library for .NET Aspire that facilitates integration with RabbitMQ. It provides extension methods to add RabbitMQ resources to your Aspire application, configure exchanges, queues, and dead letter queues, and setup references between projects.

Project Structure

Features

  • Adds a configured RabbitMQ container.
  • Support for custom exchanges and queues via definitions.json.
  • Support for dead letter exchanges (DLX).
  • Support for message TTL per queue.
  • Support for data persistence via Docker volume.
  • Support for custom credentials.
  • Support for the RabbitMQ Management UI.

Compatible Images:

  • rabbitmq

Installation

dotnet add package MVFC.Aspire.Helpers.RabbitMQ

Usage Example in AppHost

var builder = DistributedApplication.CreateBuilder(args);

var rabbitMQ = builder.AddRabbitMQ("rabbitmq")
    .WithCredentials(username: "admin", password: "password")
    .WithExchanges([
        new ExchangeConfig("test-exchange", "topic"),
        new ExchangeConfig("dead-letter", "fanout")
    ])
    .WithQueues([
        new QueueConfig("test-queue", ExchangeName: "test-exchange", RoutingKey: "test.*", DeadLetterExchange: "dead-letter"),
        new QueueConfig("empty-queue", ExchangeName: "test-exchange", RoutingKey: "empty.*"),
        new QueueConfig("dlq", ExchangeName: "dead-letter")
    ])
    .WithDataVolume("rabbit-mq");

builder.AddProject<Projects.MVFC_Aspire_Helpers_Playground_Api>("api-example")
       .WithReference(rabbitMQ)
       .WaitFor(rabbitMQ);

await builder.Build().RunAsync();

Main Parameters for AddRabbitMQ

  • name: RabbitMQ resource name.
  • amqpPort (Optional): AMQP Port (default: 5672).
  • httpPort (Optional): Management UI Port (default: 15672).

Fluent Methods

Method Description
WithDockerImage(image, tag) Overrides the Docker image used.
WithCredentials(username, password) Defines username and password.
WithExchanges(exchanges) Configures exchanges to be created.
WithQueues(queues) Configures queues to be created.
WithDataVolume(volumeName) Enables persistence with Docker volume.

Exchanges and Queues Configuration

ExchangeConfig

Parameter Type Default Description
Name string Exchange name.
Type string "direct" Type: direct, topic, fanout, headers.
Durable bool true Durable across restarts.
AutoDelete bool false Auto delete when unused.

QueueConfig

Parameter Type Default Description
Name string Queue name.
ExchangeName string? null Exchange to which the queue will be bound.
RoutingKey string? null Binding routing key (default: queue name).
Durable bool true Durable across restarts.
AutoDelete bool false Auto delete when unused.
DeadLetterExchange string? null Dead letter exchange.
MessageTTL int? null Message TTL in milliseconds.

Other important Optional parameters:

  • connectionStringSection (Optional): Defines the path to the environment variable or configuration containing the RabbitMQ connection string. Default is "ConnectionStrings:rabbitmq". Each : indicates a level/section within the appsettings.json file:
{
  "ConnectionStrings": {
    "rabbitmq": "localhost:5672"
  }
}

Requirements

  • .NET 9+
  • Aspire.Hosting >= 9.5.0

License

Apache-2.0

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 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. 
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
9.0.3 106 4/12/2026
9.0.2 94 4/12/2026
9.0.1 94 4/12/2026
9.0.0 105 4/12/2026
8.0.2 95 4/11/2026
8.0.1 104 4/3/2026
8.0.0 100 4/2/2026
7.3.3 101 3/31/2026
7.3.2 100 3/30/2026
7.3.1 102 3/30/2026
7.3.0 101 3/30/2026
7.2.2 98 3/29/2026
7.2.1 99 3/29/2026
7.2.0 95 3/29/2026
7.1.0 94 3/22/2026
6.4.4 97 3/21/2026
6.4.3 98 3/15/2026
6.4.2 99 3/15/2026
6.4.1 101 3/10/2026
6.4.0 99 3/9/2026
Loading failed