Pigeon.Messaging.Rabbit 1.0.2

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

🕊ïļ Pigeon.Messaging

Simple. Fast. Broker-agnostic messaging for .NET

Build NuGet License: MIT


Pigeon is a lightweight, extensible library for .NET (or your chosen platform) that abstracts integration with messaging systems like RabbitMQ, Kafka, Azure Service Bus, and more. Its goal is to simplify publishing and consuming messages through a unified, decoupled API, so you can switch message brokers without rewriting your business logic.


âœĻ Features

  • ✅ Consistent API for multiple message brokers
  • ⚙ïļ Fluent and flexible configuration
  • 📎 Supports common messaging patterns
  • 🔌 Easily extensible with adapters for new brokers
  • ðŸŠķ Lightweight with minimal dependencies

Pigeon is perfect for microservices, distributed architectures, and any application that needs reliable asynchronous communication.


ðŸ“Ķ Installation

dotnet add package Pigeon.Messaging
dotnet add package Pigeon.Messaging.RabbitMq // Or any Message Broker Adapter

🚀 Quick Start

⚙ïļ Configure Pigeon

Register the Pigeon infrastructure in your Program.cs (or Startup.cs):

using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Pigeon.Messaging;
using Pigeon.Messaging.Rabbit;
using System.Reflection;

var builder = Host.CreateApplicationBuilder(args);

// Register Pigeon with RabbitMQ
builder.Services.AddPigeon(builder.Configuration, config =>
{
    config.SetDomain("YourApp.Domain")
          .UseRabbitMq(rabbit =>
          {
              rabbit.Url = "amqp://guest:guest@localhost:5672";
          });
});

// Build and run your host
var app = builder.Build();
await app.RunAsync();

ðŸ“Ļ Define a Consumer

Create a message contract and a consumer handler:

public class HelloWorldMessage { }

builder.Services.AddPigeon(builder.Configuration, config =>
{
    ...
})
.AddConsumer<HelloWorldMessage>("hello-world", "1.0.0", (context, message) => {
    // Do something with the message ...
    return Task.CompletedTask;
})

A simple way to create and register your consumers is by using HubConsumer. This way, you can group related consumers into a single class.

public class CreateUserMessage { }
public class UpdateUserMessage {}
public class UpdateUserV2Message {}

public class UserHubConsumer : HubConsumer{
    
    // Support Dependency Injection
    public UserHubConsumer(IAnyService service){
      //...
      // Consuming Context Access by property Context
	 Console.WriteLine($"Received new message. Topic: {Context.Topic} Version: {Context.MessageVersion} From: {Context.From}");
    }
    
    // Easy consumer by attribute declaration
    [Consumer("create-user", "1.0.0")]
    public Task CreateUser(CreateUserMessage message, CancellationToken cancellationToken = default){
       //DO something ...
	  return Task.CompletedTask;
    }
    
    // Support for multiple versioning or topics
    [Consumer("update-user", ["1.0.1"])]
    [Consumer("update-user", ["1.0.0"])] 
    public Task UpdateUser(UpdateUserMessage message, CancellationToken cancellationToken = default){
      //DO something ...
	  return Task.CompletedTask;
    }

    // Support for multiple consumers by version 
	[Consumer("update-user", ["2.0.0"])]
    public Task UpdateUserV2(UpdateUserV2Message message, CancellationToken cancellationToken = default){
      //DO something ...
	  return Task.CompletedTask;
    }
}

Simple registration for Dependency Injection:

builder.Services.AddPigeon(builder.Configuration, config =>
{
    config.ScanConsumersFromAssemblies(typeof(UserHubConsumer).Assembly);
});

ðŸ“Ī Publish a Message

Resolve the IProducer and send a message:

var producer = app.Services.GetRequiredService<IProducer>();

await producer.PublishAsync(new MyMessage { Text = "Hello, Pigeon!" }, topic: "my-topic");

ðŸ›Ąïļ Add Interceptors (Optional)

Pigeon lets you add interceptors to run logic before or after producing/consuming:

public class MyMetadata{
    public string SomeValue { get; set; }
}

public class MyPublishInterceptor : IPublishInterceptor{
    
    // Support Dependency Injection
    public MyPublishInterceptor(IMyService service){
        
    }
    
    public ValueTask Intercept(PublishContext context, CancellationToken cancellationToken = default){	   
      // Do something...
      var myMetadata = new MyMetadata{
        SomeValue = "Attach extra information to your messages such as tracing, SAGAS information, security information, etc."  
      };
        
      context.AddMetadata("MyMetadata", myMetadata);
        
      return ValueTask.CompletedTask;
    }
}

public class MyConsumeInterceptor : IConsumeInterceptor{
    
    // Support Dependency Injection
    public MyConsumeInterceptor(IMyService service){
        
    }
    
    public ValueTask Intercept(ConsumeContext context, CancellationToken cancellationToken = default){
      var myMetadata = context.GetMetadata<MyMetadata>("MyMetadata");
	   
      // Do something...
        
      return ValueTask.CompletedTask;
    }
}
builder.Services.AddPigeon(builder.Configuration, config =>
{
    config.UseRabbitMq();

    // Add custom interceptors
})
.AddConsumeInterceptor<MyConsumeInterceptor>()
.AddPublishInterceptor<MyPublishInterceptor>();

📚 Sample appsettings.json

{
  "Pigeon": {
    "Domain": "YourApp.Domain",
    "MessageBrokers": {
        "RabbitMq": {
            "Url": "amqp://guest:guest@localhost:5672"
          }
    }  
  }
}

ðŸ§Đ Extensible by Design

✅ Pluggable broker adapters (RabbitMQ by default) ✅ Automatic consumer scanning by ConsumerAttribute ✅ Built-in support for versioning and interceptors ✅ Clean separation of concerns: ConsumingManager, ProducingManager, adapters, interceptors

🛠ïļ Upcoming Features

  • Support for Kafka and Azure Service Bus Add adapters for Kafka and Azure Service Bus message brokers.
  • Enhanced Management Capabilities Add health checking, multi-publishing, multi-consuming, failover and more.
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  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

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.11 271 8/7/2025
1.0.10 208 8/6/2025
1.0.9 207 8/6/2025
1.0.8 447 7/23/2025
1.0.7 444 7/23/2025
1.0.6 491 7/23/2025
1.0.5 493 7/23/2025
1.0.4 145 7/6/2025
1.0.3 142 7/6/2025
1.0.2 144 7/6/2025
1.0.1 142 7/6/2025