FastCSharp.RabbitSubscriber 0.0.0-alpha

This is a prerelease version of FastCSharp.RabbitSubscriber.
There is a newer version of this package available.
See the version list below for details.
dotnet add package FastCSharp.RabbitSubscriber --version 0.0.0-alpha                
NuGet\Install-Package FastCSharp.RabbitSubscriber -Version 0.0.0-alpha                
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="FastCSharp.RabbitSubscriber" Version="0.0.0-alpha" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add FastCSharp.RabbitSubscriber --version 0.0.0-alpha                
#r "nuget: FastCSharp.RabbitSubscriber, 0.0.0-alpha"                
#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 FastCSharp.RabbitSubscriber as a Cake Addin
#addin nuget:?package=FastCSharp.RabbitSubscriber&version=0.0.0-alpha&prerelease

// Install FastCSharp.RabbitSubscriber as a Cake Tool
#tool nuget:?package=FastCSharp.RabbitSubscriber&version=0.0.0-alpha&prerelease                

FastCSharp's RabbitMQ Subscriber

RabbitSubscriber provides a simple approach for subscribing to a RabbitMQ queue.
It is a wrapper around the RabbitMQ.Client library.

Usage

var exchange = new RabbitDirectExchangeFactory(configuration, loggerFactory);
using var subscriber = exchange.NewSubscriber<string>("SUBSCRIBE.SDK.DIRECT", "TASK_QUEUE");
subscriber.Subscribe(async (message, cancellationToken) =>
{
    await Task.Delay(1000, cancellationToken);
    Console.WriteLine(message);
});

appsettings.json config file sample

{
    "RabbitSubscriberConfig" : 
    {
        "HostName"  : "localhost",
        "Port"      : 5672,
        "UserName"  : "guest",
        "Password"  : "guest",
        "HeartbeatTimeout"  : "00:00:20",
        "Queues"    :
        {
            "QUEUE_TOKEN"   : 
            {
                "Name":"queue.name",
                "PrefecthCount":1,
                "PrefecthSize":0
            },
            "TASK_QUEUE"    : 
            {
                "Name":"test.direct.q",
                "PrefecthCount":1,
                "PrefecthSize":0
            }            
        }
    }
}

Adding a Circuit Breaker

The subscriber can be stopped by calling:

subscriber.UnSubscribe();

This is a useful callback when a circuit breaker is triggered and the OnOpen or OnBreak event is fired.

The subscriber can be reset by calling:

subscriber.Reset();

This is a useful callback when a circuit breaker is triggered and the OnReset event is fired.

Check the FastCSharp.CircuitBreaker package for more information on circuit breakers.

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
2.4.0 185 9/8/2024
2.3.0 249 5/7/2024
2.2.0 397 1/5/2024
2.1.0 148 12/19/2023
2.0.0 126 12/17/2023
1.0.0 192 10/20/2023
0.3.0-alpha 121 9/24/2023
0.2.1-alpha 111 9/22/2023
0.2.0-alpha 121 9/22/2023 0.2.0-alpha is deprecated because it has critical bugs.
0.0.1-alpha 114 9/18/2023
0.0.0-alpha 126 4/9/2023