Sencilla.Messaging.RabbitMQ 10.0.37

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

Sencilla.Messaging.RabbitMQ

RabbitMQ provider for the Sencilla messaging framework.

Features

  • Integrates with the Sencilla messaging pipeline (dispatcher, middleware, consumers)
  • Supports queues (point-to-point) and topics (pub/sub via fanout exchanges)
  • Automatic topology declaration (queues, exchanges, dead letter queues)
  • Health checks for monitoring RabbitMQ connectivity
  • Fluent configuration API consistent with other Sencilla providers

Configuration

services.AddSencillaMessaging(o =>
{
    o.UseRabbitMQ(c =>
    {
        // RabbitMQ connection options
        c.WithOptions(opts =>
        {
            opts.ConnectionString = "amqp://guest:guest@localhost:5672/";
            opts.PrefetchCount = 10;
            opts.EnableDeadLetterQueue = true;
        });

        // Define streams (queues and topics)
        c.AddStreams(s =>
        {
            s.AddQueue("order-events");
            s.AddQueue("notifications");
            s.AddTopic("broadcast-events");
        });

        // Route message types to streams
        c.AddRoutes(r =>
        {
            r.Send<OrderPlacedEvent>().ToStream("order-events");
            r.Send<NotificationMessage>().ToStream("notifications");
        });

        // Configure consumers
        c.AddConsumers(consumers =>
        {
            consumers.ForQueue("order-events", cfg =>
            {
                cfg.MaxConcurrentHandlers = 5;
                cfg.PrefetchCount = 10;
            });
            consumers.ForQueue("notifications");
        });
    });
});

Attribute-based routing

[Stream("order-events")]
public class OrderPlacedEvent
{
    public string OrderId { get; set; }
    public decimal Amount { get; set; }
}

Publishing messages

public class OrderService(IMessageDispatcher dispatcher)
{
    public async Task PlaceOrder(Order order)
    {
        // Process order...

        await dispatcher.Send(new OrderPlacedEvent
        {
            OrderId = order.Id,
            Amount = order.Total
        });
    }
}

Handling messages

public class OrderPlacedHandler : IMessageHandler<OrderPlacedEvent>
{
    public async Task HandleAsync(OrderPlacedEvent message, CancellationToken token)
    {
        // Process the order event
    }
}

// Register handler
services.AddTransient<IMessageHandler<OrderPlacedEvent>, OrderPlacedHandler>();

Consumer modes

By default, consumers auto-start as a BackgroundService. For standalone worker services:

c.AutoStartConsumers = false; // Register as singleton, not hosted service

Then inject and run manually:

public class MyWorker(
    MessageStreamsConsumer<RabbitMQStreamProvider, RabbitMQProviderConfig> consumer) : BackgroundService
{
    protected override Task ExecuteAsync(CancellationToken stoppingToken)
        => consumer.ExecuteConsumersAsync(stoppingToken);
}

Topology management

For advanced scenarios, inject IRabbitMQTopologyManager directly:

public class SetupService(IRabbitMQTopologyManager topology)
{
    public async Task SetupAsync()
    {
        await topology.DeclareExchangeAsync("events", ExchangeType.Topic);
        await topology.DeclareQueueAsync("user-events");
        await topology.BindQueueAsync("user-events", "events", "user.*");
        await topology.SetupDeadLetterQueueAsync("user-events");
    }
}

Health checks

Health checks are registered automatically with the rabbitmq tag:

app.MapHealthChecks("/health");

Configuration options

Option Description Default
ConnectionString AMQP connection URI amqp://guest:guest@localhost:5672/
DefaultExchange Default exchange name "" (nameless)
PrefetchCount Consumer prefetch count 10
AutoDeclareTopology Auto-declare queues/exchanges true
EnableDeadLetterQueue Enable DLQ support true
DeadLetterExchange DLX name dlx
DeadLetterQueue DLQ suffix dlq
MessageTtlMilliseconds Message TTL (0 = no expiration) 0
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
10.0.37 57 6/6/2026
10.0.36 50 6/6/2026
10.0.35 53 6/5/2026
10.0.34 49 6/5/2026
10.0.32 84 6/4/2026
10.0.31 81 6/4/2026
10.0.30 86 6/4/2026
10.0.29 85 6/4/2026
10.0.28 88 6/3/2026
10.0.27 87 6/3/2026
10.0.26 84 6/2/2026
10.0.19 92 6/1/2026
10.0.18 93 6/1/2026
10.0.17 86 5/13/2026
10.0.16 98 5/12/2026
10.0.15 94 5/12/2026
10.0.14 97 5/1/2026
10.0.13 106 3/29/2026
10.0.12 109 3/2/2026
10.0.11 104 2/27/2026
Loading failed