Oragon.RabbitMQ
Consume RabbitMQ Queues like Minimal API's
Install / Use
/learn @luizcarlosfaria/Oragon.RabbitMQREADME

Oragon.RabbitMQ
Minimal APIs for RabbitMQ in .NET — Consume queues with the same MapQueue() pattern you already know from MapPost().
Oragon.RabbitMQ is not HTTP/Kestrel-based. It is a fully custom implementation built on RabbitMQ.Client 7.x natively.
Quality
Releases
Project
What is Oragon.RabbitMQ?
If you know ASP.NET Core Minimal APIs, you already know Oragon.RabbitMQ:
// ASP.NET Core — HTTP
app.MapPost("/orders", ([FromServices] OrderService svc, [FromBody] OrderCreated msg) => svc.HandleAsync(msg));
// Oragon.RabbitMQ — AMQP
app.MapQueue("orders", ([FromServices] OrderService svc, [FromBody] OrderCreated msg) => svc.HandleAsync(msg));
It provides everything you need to create resilient RabbitMQ consumers without the need to study numerous books and articles or introduce unknown risks to your environment. All queue consumption settings are configurable through a friendly, fluent, and consistent API.
Why Oragon.RabbitMQ?
- Minimal API design — familiar
MapQueue()pattern, zero learning curve for ASP.NET Core developers - RabbitMQ.Client 7.x native — no HTTP, no Kestrel, pure AMQP
- Near-zero overhead — benchmarks prove 0-1% overhead for I/O-bound workloads
- Built-in resilience — automatic Ack/Nack/Reject with manual acknowledgment by default
- DI-first —
[FromServices],[FromBody],[FromAmqpHeader]attribute binding - Pluggable serialization — System.Text.Json or Newtonsoft.Json out of the box
- Composable flow control — Ack, Nack, Reject, Reply, Forward, and Compose results
- .NET Aspire integration — first-class support via
Oragon.RabbitMQ.AspireClient - OpenTelemetry native — via RabbitMQ.Client 7.x built-in instrumentation
- Multi-framework — targets .NET 8, 9, and 10
Quick Start
Standalone
dotnet add package Oragon.RabbitMQ
dotnet add package Oragon.RabbitMQ.Serializer.SystemTextJson
using Oragon.RabbitMQ;
using Oragon.RabbitMQ.Serializer;
using RabbitMQ.Client;
var builder = Host.CreateApplicationBuilder(args);
// 1. Register consumer infrastructure
builder.AddRabbitMQConsumer();
// 2. Register serializer
builder.Services.AddAmqpSerializer(options: JsonSerializerOptions.Default);
// 3. Register RabbitMQ connection
builder.Services.AddSingleton<IConnectionFactory>(sp => new ConnectionFactory()
{
Uri = new Uri("amqp://guest:guest@localhost:5672"),
DispatchConsumersAsync = true
});
builder.Services.AddSingleton(sp =>
sp.GetRequiredService<IConnectionFactory>().CreateConnectionAsync().GetAwaiter().GetResult());
// 4. Register your service
builder.Services.AddSingleton<OrderService>(); // singleton, scoped or transient
var app = builder.Build();
Example 1
// 5. Map queue to handler
app.MapQueue("orders", ([FromServices] OrderService svc, OrderCreated msg) =>
svc.HandleAsync(msg));
app.Run();
Example 2
Asume the controller has a method CanProcess that returns a boolean.
app.MapQueue("orders", async ([FromServices] OrderService svc, OrderCreated msg) =>
{
if (svc.CanProcess(msg))
{
await svc.HandleAsync(msg);
return AmqpResults.Ack();
}
return AmqpResults.Nack(requeue: true);
});
Example 3
You can also handle exceptions yourself and return a valid IAmqpResult:
app.MapQueue("orders", async ([FromServices] OrderService svc, OrderCreated msg) =>
{
try
{
await svc.HandleAsync(msg);
return AmqpResults.Ack();
}
catch (Exception ex)
{
// Log the exception
return AmqpResults.Nack(requeue: true);
}
});
With .NET Aspire
Replace Aspire.RabbitMQ.Client with Oragon.RabbitMQ.AspireClient to get RabbitMQ.Client 7.x support:
dotnet add package Oragon.RabbitMQ.AspireClient
builder.AddRabbitMQClient("rabbitmq");
After
Aspire.RabbitMQ.Clientgains RabbitMQ.Client 7.x support, theOragon.RabbitMQ.AspireClientpackage will be deprecated.
Packages
| Package | Purpose |
| ------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------- |
| Oragon.RabbitMQ | Core library — consumer infrastructure, MapQueue, flow control |
| Oragon.RabbitMQ.Abstractions | Interfaces (IAmqpResult, IAmqpSerializer, IAmqpContext) |
| Oragon.RabbitMQ.Serializer.SystemTextJson | System.Text.Json serializer |
| Oragon.RabbitMQ.Serializer.NewtonsoftJson | Newtonsoft.Json serializer |
| Oragon.RabbitMQ.AspireClient | .NET Aspire integration (RabbitMQ.Client 7.x) |
Configuration Reference
All configuration is done through fluent methods on the ConsumerDescriptor returned by MapQueue():
| Method | Description | Default |
| ------------------------------------------------------------------------------- | --------------------------------------------- | ------------------------- |
| .WithPrefetch(ushort) | Number of messages prefetched from the broker | 1 |
| .WithDispatchConcurrency(ushort) | Concurrent message processing slots | 1 |
| .WithConsumerTag(string) | Custom consumer tag | auto-generated |
| .WithExclusive(bool) | Exclusive consumer on the queue | false |
| .WithTopology(Func<IChannel, CancellationToken, Task>) | Declare exchanges/queues/bindings
Related Skills
node-connect
341.6kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
84.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
341.6kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
84.6kCommit, push, and open a PR
