app.MapQueue() - RabbitMQ Consumers like Minimal API's in .NET

app.MapQueue() - RabbitMQ Consumers like Minimal API's in .NET

Imagine a world where consuming messages from RabbitMQ is as straightforward as defining an HTTP endpoint in ASP.NET. No more wrestling with boilerplate code, no more hidden configurations—just clean, resilient, and efficient message handling. Welcome to the realm of Oragon.RabbitMQ.

🧩 The Puzzle of Message Consumption

RabbitMQ is a powerful message broker, but integrating it seamlessly into .NET applications can be a daunting task. Developers often grapple with intricate configurations, manual acknowledgments, and the challenge of ensuring message resilience.

Enter Oragon.RabbitMQ, a library crafted by Luiz Carlos Faria, a seasoned software architect and Microsoft MVP. This tool reimagines the RabbitMQ consumption experience by introducing a minimal API approach, akin to ASP.NET Minimal APIs, but tailored for message queues.

🔍 Unpacking Oragon.RabbitMQ

At its core, Oragon.RabbitMQ simplifies the process of consuming messages from RabbitMQ queues. It abstracts the complexities of the underlying RabbitMQ.Client library, offering developers a streamlined and intuitive interface. Key features include:

  • Minimal API Approach: Define message handlers with the simplicity of minimal APIs, reducing boilerplate and enhancing readability.
  • Manual Acknowledgment: Gain fine-grained control over message processing, ensuring resilience and reliability.
  • Flexible Argument Binding: Automatically bind message data to handler parameters, leveraging attributes like [FromServices] and [FromBody].
  • Integration Options: Seamlessly integrate with different serialization libraries and .NET Aspire, adapting to various project needs.
  • Decoupled Design: Keep business logic isolated from infrastructure concerns, promoting maintainability and scalability.

This design empowers developers to focus on what truly matters—implementing business logic—without getting bogged down by the intricacies of message queue consumption.

Oragon.RabbitMQ is more than just a library; it's a bridge connecting developers worldwide, offering a unified approach to handling RabbitMQ in .NET applications.

Showcase

Article content

Imagine applying the same elegance and simplicity of ASP.NET Minimal APIs—not to HTTP, but to RabbitMQ. That’s the core of Oragon.RabbitMQ: it brings the same fashion way of Minimal APIs to message consumption. Instead of verbose boilerplate and tightly coupled consumers, you define lightweight, expressive handlers with a clean, declarative style. Just like Minimal APIs let you expose endpoints with minimal ceremony, Oragon lets you declare message consumers with clarity, resilience, and precision—transforming queue consumption into something as intuitive as defining a route.

Article content

With Oragon.RabbitMQ, you're not just consuming messages—you’re in full control of how they're handled. You can decide when to ack, nack, or reject a message, giving you precise command over the lifecycle of each delivery. Fine-tune your system with custom prefetch settings and control concurrency levels to optimize throughput without sacrificing stability. It's a deliberate design that empowers developers to build resilient, production-grade consumers—without losing the flexibility to adapt to complex business scenarios.


Article content

With Oragon.RabbitMQ, you have full control when you need it—but you’re not forced to deal with complexity when you don’t. By default, the framework handles ack, nack, and reject for you, following best practices to ensure reliability and safety. But when the time comes to fine-tune behavior—adjust prefetch, manage concurrency, or take explicit control over message acknowledgment—everything is there, ready for you to step in. It’s simplicity when you want it, and power when you need it.

Resilience is the only way

Oragon.RabbitMQ does not support non-resilient consumption. Resilience isn't just the default—it's the only way. Every message is processed with safety in mind, ensuring reliability, durability, and fault tolerance by design. If you're looking for fire-and-forget consumers, this isn't the tool. But if you care about building robust, production-ready systems, Oragon.RabbitMQ was made for you.

Just create a queue with a dead-letter configuration—and you’re done. Oragon.RabbitMQ takes care of the rest.

No need to write custom retry logic, no need to wrap your handlers in error-prone try-catch blocks. If a message fails, it’s safely rerouted to your dead-letter queue, preserving system stability and giving you full visibility into what went wrong. It’s resilience by design, with zero boilerplate.

Choose your serializer

Oragon.RabbitMQ gives you the freedom to choose your JSON serializer. Whether you prefer the flexibility of Newtonsoft.Json or the performance and native support of System.Text.Json, both are fully supported. You’re not locked into one or the other—pick the one that best fits your project’s needs, or switch later without rewriting your consumers. Serialization is just a detail, not a limitation.

Aspire First

Oragon.RabbitMQ was built with .NET Aspire in mind—offering native integration from the start. It aligns perfectly with modern .NET architecture, letting you plug your consumers directly into the .NET Aspire ecosystem with zero friction. Under the hood, it leverages the latest (7.x) version of the RabbitMQ.Client, ensuring full compatibility with recent features, better performance, and long-term support. It's a future-proof foundation for building resilient, cloud-native message-driven systems in .NET.

.NET Aspire is not a requirement—Oragon.RabbitMQ works seamlessly with or without it. While it offers native support for Aspire to streamline configuration in cloud-native scenarios, the framework remains completely independent and flexible. You can integrate it into any .NET application, from minimal services to complex architectures, without needing .NET Aspire at all. It's designed to adapt to your stack—not the other way around.

🚀 Embark on the Oragon.RabbitMQ Journey

Ready to revolutionize your RabbitMQ consumption experience? Dive into the unofficial documentation and explore the GitHub repository to get started.

Discover how Oragon.RabbitMQ can transform your .NET applications, making message handling more intuitive, resilient, and efficient.

GitHub: https://github.com/luizcarlosfaria/Oragon.RabbitMQ

Nuget: https://www.nuget.org/packages/Oragon.RabbitMQ/

Have questions? Let’s talk in the comments—your feedback is more than welcome. Oragon.RabbitMQ is open-source and released under the MIT license, so you're free to use, modify, and contribute. Whether you're exploring resilient architectures or deep-diving into advanced messaging patterns, this project is built to grow with the community. Let’s shape it together.


Isaías Vasconcelos

Desenvolvedor .NET | C# | ASP.NET Core | REST API | MySQL | PostgreSQL | SQL Server | Docker | NGINX | RabbitMQ

2mo

Wow🔥

Like
Reply
Paulo Henrique De Araujo Gerchon

Founding Senior Software Engineer at Lucidly 💎 | The Customer Intelligence Platform for Revenue Teams | Full Stack Developer | C# | Python| React | Azure

2mo

Big thanks for sharing, Luiz Carlos

Like
Reply

To view or add a comment, sign in

Others also viewed

Explore topics