RepletoryLib.Messaging.RabbitMQ 1.0.0

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

RepletoryLib.Messaging.RabbitMQ

MassTransit-based RabbitMQ implementation of IMessagePublisher and IEventBus.

Part of the RepletoryLib ecosystem -- standalone, reusable .NET 10 libraries with zero business logic.

NuGet .NET 10 License: MIT


Overview

RepletoryLib.Messaging.RabbitMQ provides a production-ready implementation of IMessagePublisher and IEventBus from RepletoryLib.Messaging.Abstractions using MassTransit with RabbitMQ transport. It supports consumer registration, dead letter queues, configurable concurrency, and retry policies.

Key Features

  • MassTransit integration -- Built on MassTransit for robust messaging patterns
  • Consumer registration -- Register message consumers via the configuration callback
  • Dead letter queues -- Automatic DLQ for failed messages
  • Configurable concurrency -- Prefetch count and concurrent message limits
  • Retry policies -- Built-in retry with configurable count and interval

Installation

dotnet add package RepletoryLib.Messaging.RabbitMQ

Dependencies

Package Type
RepletoryLib.Messaging.Abstractions RepletoryLib
MassTransit.RabbitMQ NuGet (8.3.6)

Prerequisites

  • RabbitMQ 3+ with management plugin
docker-compose up -d rabbitmq

Quick Start

using RepletoryLib.Messaging.RabbitMQ;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddRepletoryRabbitMQ(builder.Configuration, cfg =>
{
    cfg.AddConsumer<OrderCreatedConsumer>();
    cfg.AddConsumer<PaymentProcessedConsumer>();
});
{
  "Messaging": {
    "RabbitMQ": {
      "Host": "localhost",
      "Port": 5672,
      "VirtualHost": "/",
      "Username": "repletory",
      "Password": "Repletory@123!",
      "RetryCount": 3,
      "RetryIntervalSeconds": 5,
      "PrefetchCount": 16,
      "ConcurrentMessageLimit": 1,
      "EnableDeadLetterQueue": true
    }
  }
}

Configuration

RabbitMqOptions

Property Type Default Description
Host string "localhost" RabbitMQ server host
Port int 5672 AMQP port
VirtualHost string "/" RabbitMQ virtual host
Username string "guest" Authentication username
Password string "guest" Authentication password
RetryCount int 3 Message retry attempts
RetryIntervalSeconds int 5 Delay between retries
PrefetchCount int 16 Messages to prefetch
ConcurrentMessageLimit int 1 Max concurrent message processing
EnableDeadLetterQueue bool true Enable DLQ for failed messages

Usage Examples

Publishing Events

using RepletoryLib.Messaging.Abstractions.Interfaces;

public class OrderService
{
    private readonly IMessagePublisher _publisher;

    public OrderService(IMessagePublisher publisher) => _publisher = publisher;

    public async Task CreateOrderAsync(Order order)
    {
        await _repository.SaveAsync(order);
        await _publisher.PublishAsync(new OrderCreatedEvent
        {
            OrderId = order.Id,
            CustomerId = order.CustomerId,
            Total = order.Total
        });
    }
}

Creating a Consumer

using RepletoryLib.Messaging.Abstractions.Interfaces;
using RepletoryLib.Messaging.Abstractions.Models;

public class OrderCreatedConsumer : IMessageConsumer<OrderCreatedEvent>
{
    private readonly IEmailService _email;

    public OrderCreatedConsumer(IEmailService email) => _email = email;

    public async Task ConsumeAsync(ConsumeContext<OrderCreatedEvent> context,
        CancellationToken cancellationToken = default)
    {
        await _email.SendOrderConfirmationAsync(context.Message.OrderId);
    }
}

Using IEventBus for Commands

using RepletoryLib.Messaging.Abstractions.Interfaces;

// Send a command to a specific queue (point-to-point)
await _eventBus.SendAsync(new ProcessPaymentCommand
{
    OrderId = orderId,
    Amount = 500m
}, "queue:payment-processor");

Integration with Other RepletoryLib Packages

Package Relationship
RepletoryLib.Messaging.Abstractions Implements IMessagePublisher, IEventBus
RepletoryLib.Messaging.Outbox Reliable outbox pattern before publishing to RabbitMQ
RepletoryLib.Testing MockMessagePublisher for unit testing
RepletoryLib.HealthChecks RabbitMQ health check included

Troubleshooting

Issue Solution
Connection refused Ensure RabbitMQ is running and credentials are correct. Check Host, Port, Username, Password.
Consumer not receiving messages Verify the consumer is registered in AddRepletoryRabbitMQ callback
Messages going to DLQ Check consumer logs for exceptions. Messages fail after RetryCount attempts.
High memory on RabbitMQ Reduce PrefetchCount or increase consumer ConcurrentMessageLimit

License

This project is licensed under the MIT License.

Copyright (c) 2024-2026 Repletory.


For complete documentation, infrastructure setup, and configuration reference, see the RepletoryLib main repository.

Product Compatible and additional computed target framework versions.
.NET 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
1.0.0 77 3/2/2026