ReQueue 1.1.0

dotnet add package ReQueue --version 1.1.0
NuGet\Install-Package ReQueue -Version 1.1.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="ReQueue" Version="1.1.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ReQueue --version 1.1.0
#r "nuget: ReQueue, 1.1.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.
// Install ReQueue as a Cake Addin
#addin nuget:?package=ReQueue&version=1.1.0

// Install ReQueue as a Cake Tool
#tool nuget:?package=ReQueue&version=1.1.0

.NET NuGet Downloads NuGet Version

ReQueue

C# Library to use a redis list for asynchronous messaging. Perfect for small projects you don't want to set up RabbitMQ for. Try using it with a fast redis implemetation like Dragonfly.

Example

Object

The library uses MessagePack under the hood, so make sure your object is marked as MessagePack serilizable.

[MessagePackObject(keyAsPropertyName: true)]
public class Data
{
    public int Foo { get; set; }
}

Producer

internal class Program
{
    static async Task Main(string[] args)
    {
        var manager = new ConnectionHub("localhost", 0);
        var queue = manager.GetMessageQueue<Data>("numQueue");

        for (int i = 0; i < 100; i++)
        {
            var item = new Data { Foo = i };
            await queue.EnqueueMessages(item);
            Console.WriteLine($"Sending -> {i}");
        }

        Console.ReadLine();
    }
}

Consumer

internal class Program
{
    static async Task Main(string[] args)
    {
        var manager = new ConnectionHub("localhost", 0);
        var queue = manager.GetMessageQueue<Data>("numQueue");
        var tokenSource = new CancellationTokenSource();
        tokenSource.CancelAfter(TimeSpan.FromDays(6));

        await queue.DequeueMessages(new Action<Data>(x => {
            Console.WriteLine($"Recieved -> {x.Foo}");
        }), tokenSource.Token);
        Console.ReadLine();
    }
}

Filter Example

queue.DequeueMessages(new Action<Data>(x => {
    Console.WriteLine($"Recieved -> {x.Foo}");
}), tokenSource.Token, new Func<Data, bool>((data) => {
    if (data != null)
    {
        if (data.Foo % 2 == 0)
        {
            return true;
        }
    }

    return false;
}));

License

MIT License

Copyright (c) 2024 Greg James

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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. 
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.1.0 87 2/18/2024
1.0.0 87 2/18/2024