InovaNotas.MirageQueue.PostgreSQL 2.0.1

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

Mirage Queue

This library was intended to help us have the benefits of a message broker without having another infrastructure dependency, meaning it was designed to use a database as a message broker.

Currently this library only supports PostgreSQL database

You can download the package via Nuget using the command below or the Nuget interface in the IDE.

dotnet add package InovaNotas.MirageQueue.PostgreSQL

The initial is pretty simple as you can see:

using MirageQueue;
using MirageQueue.Postgres;
using MirageQueue.Publishers.Abstractions;

var builder = WebApplication.CreateBuilder(args);


//Configure the default options for MirageQueue
builder.Services.AddMirageQueue();

//Configure Mirage Queue to use the postgres database 
builder.Services.AddMirageQueuePostgres(builder.Configuration.GetConnectionString("DefaultConnection"));

//Register all consumers in the given assembly
builder.Services.AddConsumersFromAssembly(typeof(TestMessageConsumer).Assembly);


var app = builder.Build();

// Create the database and all tables needed to run the Mirage Queue
app.UseMirageQueue();

app.Run();

Instead of registering all consumers from a specific assembly you can off course register one by one like this:

builder.Services.AddConsumer<TestMessageConsumer>();

To create a consumer you need to implement the interface IConsumer with the type parameter of the expected message that you want to receive, and you can have multiple consumers receiving the same message type.

using MirageQueue.Consumers.Abstractions;
using System.Text.Json;

namespace ExampleApi;

public class TestMessageConsumer : IConsumer<TestMessage>
{
    private readonly Random _random = new Random();
    public async Task Process(TestMessage message)
    {
        Console.WriteLine($"Test message {DateTime.Now:hh:mm:ss} {JsonSerializer.Serialize(message)}");
        await Task.Delay(TimeSpan.FromMicroseconds(_random.Next(40, 100)));
    }
}

This library provides two ways to deliver messages to the consumer. The first option lets the consumer receive and process the message immediately after it’s sent. The second option allows you to schedule the message for processing at a later time. You can use the IPublisher interface via dependency injection.

public class MyService(IPublisher publisher){
    public async Task PublishMessage(){
        await publisher.Publish(new TestMessage
        {
            Id = Guid.NewGuid()
        });
    }

    public async Task ScheduleMessage(){
        await publisher.Publish(new TestMessage
        {
            Id = Guid.NewGuid()
        },
        DateTime.UtcNow.AddSeconds(3));
    }
}
Product Compatible and additional computed target framework versions.
.NET 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
2.4.0 138 2/14/2026
2.3.1 294 11/12/2025
2.3.0 166 8/9/2025
2.2.0 406 6/29/2025
2.1.0 201 6/29/2025
2.0.1 306 11/19/2024
2.0.0 261 11/15/2024