Messaging.RabbitMq.Core 1.0.2

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

Messaging.RabbitMq

Shared RabbitMQ configuration and publisher utilities for all services. REQUIRED for publishing notification events.

Installation

dotnet add package Messaging.RabbitMq

Configuration

Add to your appsettings.json:

{
  "RabbitMq": {
    "Host": "localhost",
    "Port": 5672,
    "VirtualHost": "/",
    "Username": "guest",
    "Password": "guest"
  }
}

Usage

Register in Program.cs

using Messaging.RabbitMq.Extensions;

var builder = WebApplication.CreateBuilder(args);

// Add RabbitMQ messaging (required for all services that publish notifications)
builder.Services.AddRabbitMqMessaging(builder.Configuration);

// For services that also consume events (e.g., NotificationService):
builder.Services.AddRabbitMqMessaging(builder.Configuration, x =>
{
    x.AddConsumer<NotificationEventConsumer>();
});

Publish Events

Inject INotificationEventPublisher and publish events:

using Messaging.RabbitMq.Publishers;
using NotificationService.Contracts.Events;

public class QuestionnaireService
{
    private readonly INotificationEventPublisher _notificationPublisher;

    public QuestionnaireService(INotificationEventPublisher notificationPublisher)
    {
        _notificationPublisher = notificationPublisher;
    }

    public async Task SubmitQuestionnaireAsync(QuestionnaireSubmission submission)
    {
        // ... save submission ...

        // Publish notification event
        await _notificationPublisher.PublishAsync(new QuestionnaireSubmittedEvent
        {
            TenantId = submission.TenantId,
            UserId = templateOwnerId,
            QuestionnaireId = submission.Id,
            TemplateId = submission.TemplateId,
            TemplateName = template.Name,
            RespondentName = submission.RespondentName
        });
    }
}

Batch Publishing

For multiple notifications:

var events = users.Select(u => new TemplateUpdatedEvent
{
    TenantId = tenantId,
    UserId = u.Id,
    TemplateId = template.Id,
    TemplateName = template.Name,
    UpdatedByUserName = currentUser.Name
});

await _notificationPublisher.PublishBatchAsync(events);

Features

  • Automatic Retry: Messages are retried with exponential backoff (1s, 5s, 15s, 30s)
  • In-Memory Outbox: Ensures messages are published reliably within a transaction
  • Structured Logging: All publish operations are logged with correlation IDs

Dependencies

  • MassTransit.RabbitMQ - Message broker abstraction
  • NotificationService.Contracts - Event contracts

License

MIT

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.1.1 186 7/8/2026
1.0.2 731 3/7/2026
1.0.1 1,112 1/30/2026