Making.RabbitMQ 1.0.4-preview

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

Making.RabbitMQ

RabbitMQ client utilities and extensions for the Making framework.

Overview

Making.RabbitMQ provides essential RabbitMQ client utilities and connection management for the Making framework. It offers a robust foundation for building messaging solutions with connection pooling, retry logic, and configuration management.

Features

  • Connection Management: Robust RabbitMQ connection handling with automatic reconnection
  • Configuration Support: Easy configuration through options pattern
  • Connection Pooling: Efficient connection reuse and management
  • Retry Logic: Built-in retry mechanisms for failed operations
  • Logging Integration: Comprehensive logging for debugging and monitoring
  • Dependency Injection: Full DI container integration

Installation

dotnet add package Making.RabbitMQ

Usage

Configuration

{
  "RabbitMQ": {
    "ConnectionString": "amqp://guest:guest@localhost:5672/",
    "VirtualHost": "/",
    "Username": "guest",
    "Password": "guest",
    "HostName": "localhost",
    "Port": 5672,
    "RequestedHeartbeat": 60,
    "NetworkRecoveryInterval": 10,
    "AutomaticRecoveryEnabled": true,
    "TopologyRecoveryEnabled": true
  }
}

Register Services

services.AddMakingRabbitMQ(configuration);

Using RabbitMQ Connection

public class MessageService
{
    private readonly IRabbitMqConnection _connection;
    private readonly ILogger<MessageService> _logger;
    
    public MessageService(IRabbitMqConnection connection, ILogger<MessageService> logger)
    {
        _connection = connection;
        _logger = logger;
    }
    
    public async Task SendMessageAsync(string queueName, string message)
    {
        using var channel = _connection.CreateChannel();
        
        // Declare queue
        channel.QueueDeclare(
            queue: queueName,
            durable: true,
            exclusive: false,
            autoDelete: false,
            arguments: null);
        
        // Prepare message
        var body = Encoding.UTF8.GetBytes(message);
        var properties = channel.CreateBasicProperties();
        properties.Persistent = true;
        
        // Publish message
        channel.BasicPublish(
            exchange: "",
            routingKey: queueName,
            basicProperties: properties,
            body: body);
        
        _logger.LogInformation("Message sent to queue {QueueName}", queueName);
    }
    
    public async Task<string> ReceiveMessageAsync(string queueName)
    {
        using var channel = _connection.CreateChannel();
        
        // Declare queue
        channel.QueueDeclare(
            queue: queueName,
            durable: true,
            exclusive: false,
            autoDelete: false,
            arguments: null);
        
        // Get message
        var result = channel.BasicGet(queueName, autoAck: true);
        
        if (result != null)
        {
            var message = Encoding.UTF8.GetString(result.Body.ToArray());
            _logger.LogInformation("Message received from queue {QueueName}", queueName);
            return message;
        }
        
        return null;
    }
}

Advanced Usage with Options

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        services.Configure<RabbitMqOptions>(options =>
        {
            options.ConnectionString = "amqp://localhost:5672";
            options.AutomaticRecoveryEnabled = true;
            options.NetworkRecoveryInterval = TimeSpan.FromSeconds(10);
            options.RequestedHeartbeat = TimeSpan.FromSeconds(60);
        });
        
        services.AddMakingRabbitMQ();
    }
}

Requirements

  • .NET Standard 2.0+
  • RabbitMQ Server
  • RabbitMQ.Client
  • Microsoft.Extensions.DependencyInjection
  • Microsoft.Extensions.Options.ConfigurationExtensions
  • Microsoft.Extensions.Logging
  • System.Text.Json
  • Making.Core

License

This project is part of the Making framework.

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 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 (2)

Showing the top 2 NuGet packages that depend on Making.RabbitMQ:

Package Downloads
Making.Events.RabbitMQ

RabbitMQ event bus implementation for the Making framework

Making.EventBus.RabbitMQ

RabbitMQ event bus implementation for the Making framework

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.4-preview 11 8/10/2025
1.0.1-preview 319 7/25/2025
1.0.0-preview 394 7/25/2025