CodeQuartz.Portal 1.0.0

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

CodeQuartz.Portal.RabbitMQ

A simple and extensible RabbitMQ integration library for .NET applications.

This library provides a lightweight abstraction over RabbitMQ to simplify message publishing and consumption using common patterns like dependency injection (ISender, IReceiver), fluent configuration, and support for multiple queues.


✨ Features

  • 📤 Publish messages with automatic JSON serialization.
  • 📥 Consume messages asynchronously with built-in ACK/NACK control.
  • ⚙️ Easy integration with IServiceCollection and dependency injection.
  • 🔄 Supports durable queues and custom exchange/queue settings.
  • 🔐 Built-in configuration for multiple queues and secure connection options.

🚀 Installation

Install via NuGet:

dotnet add package CodeQuartz.Portal

🧩 Configuration

1. Register the sender

services.AddPortalSender(options =>
{
    options.Exchange = "my-exchange";
    options.ExchangeType = "direct";
    options.Queues = ["queue-a", "queue-b"];
    options.HostConfig = new QueueConfiguration
    {
        Host = "localhost",
        Port = 5672,
        Username = "guest",
        Password = "guest"
    };
});

📤 Sending Messages

public class HelloCommand
{
    public required string Name { get; set; }
}

public class QueueService
{
    private readonly ISender _sender;

    public QueueService(ISender sender)
    {
        _sender = sender;
    }

    public async Task SendMessage()
    {
        var command = new HelloCommand { Name = "Test" };
        await _sender.Send("queue-a", command);
    }
}

📥 Listening for Messages

var portal = new PortalBuilder(new QueueOptions
{
    Exchange = "my-exchange",
    Queues = ["queue-a"],
    HostConfig = new QueueConfiguration
    {
        Host = "localhost",
        Port = 5672,
        Username = "guest",
        Password = "guest"
    }
}).UsePortal().GetAwaiter().GetResult();

var receiver = new PortalReceiver(portal, "my-exchange");
await receiver.Listen<HelloCommand>("queue-a", autoAck: false, async command =>
{
    Console.WriteLine($"Received: {command.Name}");
    return true;
});

receiver.Run();

🛠️ Components

PortalSender

  • Publishes messages using an IChannel.
  • JSON-serializes objects before publishing.
  • Injectable via ISender.

PortalReceiver

  • Listens to a specific queue.
  • Deserializes messages and handles acknowledgment based on the callback's result.

PortalBuilder

  • Initializes the RabbitMQ connection and channel.
  • Declares exchanges and queues, and binds queues to the exchange.

✅ Requirements

  • .NET 8 or later
  • Running RabbitMQ Server

📄 License

This project is licensed under the MIT License.

🤝 Contributing

Contributions are welcome! Feel free to open issues or pull requests with improvements, bug fixes, or suggestions.

🧠 Author

Developed with ❤️ by Daniel Lopes

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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.0 141 6/14/2025