SwitchSoftware.Messaging.RPC.RabbitMQ 10.0.1

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

Switch Software RPC implementation for RabbitMQ

⚠️ Requires .NET 10: Starting from version 10.0.1, this package targets net10.0, aligned with the package version and RabbitMQ.Client 7.0.0. Stay on 10.0.0 if you need netstandard2.1.

Installation

nuget repo : https://www.nuget.org/packages/SwitchSoftware.Messaging.RPC.RabbitMQ

dotnet add package SwitchSoftware.Messaging.RPC.RabbitMQ --version 10.0.1

Usage

Instantatiate an RPCServer to listen on "myQueue" and handle requests in the handlerequest method:


    _rpcServer.Start();

    private async Task<string> handleRequest(string data)
    {
        //handle your request
        return $"Hello, you sent me {data}";
    }

You will need to pass an IConfiguration and ILogger instances as well.

Configuration

The server relies on the following app settings (adjust to your RabbitMQ instance):

"RabbitMqConnection": {
  "HostName": "localhost",
  "UserName": "guest",
  "Password": "guest",
  "VirtualHost": "/",
  "Port": "5672",
  "RPC_CLIENT_TIME_OUT_IN_MILLISECONDS": "60000"
}

Note: Port and RPC_CLIENT_TIME_OUT_IN_MILLISECONDS are optional. The default timeout is 45 000 ms.

⚠️ Breaking change from 8.0.3-alpha: The config key was renamed from Username to UserName (capital N). Update your appsettings.json accordingly.

RPC Client

To send a request to the server, instantiate an RPCClient through the RpcClientFactory and call the CallAsync method:

var rpcClientFactory = new RpcClientFactory(configuration, logger);
var rpcClient = rpcClientFactory.GetRpcClient();
var response = await rpcClient.CallAsync("testqueue", "Hello!");

The client also relies on the RabbitMqConnection app settings.

Starting in 8.0.4, failed messages are rejected with requeue: false instead of being re-enqueued. Configure a dead-letter exchange so those messages are not silently dropped:

"RabbitMqConnection": {
  "HostName": "localhost",
  "UserName": "guest",
  "Password": "guest",
  "VirtualHost": "/"
}

Declare the DLX on the RabbitMQ broker before starting the server:

rabbitmqadmin declare exchange name=dlx type=direct
rabbitmqadmin declare queue name=myQueue.failed
rabbitmqadmin declare binding source=dlx destination=myQueue.failed routing_key=myQueue

Then declare your server queue with the DLX argument:

// When constructing RpcServer the queue is declared internally.
// To attach a DLX, pre-declare the queue on the broker with:
//   x-dead-letter-exchange = dlx
//   x-dead-letter-routing-key = myQueue

Release Changes

  • Fixed ChannelAllocationException regression introduced in 8.0.4:
    • RpcClient no longer over-releases its concurrency semaphore when WaitAsync is cancelled, which previously allowed unbounded concurrent channel creation on the underlying connection.
    • RpcClient now cancels the reply-queue consumer (BasicCancel) before returning a channel to the pool, preventing accumulation of dead consumers and orphaned exclusive auto-delete reply queues on pooled channels.
  • Channel pooling behavior is preserved.

Version History

Version Notes
10.0.1 Upgrades RabbitMQ.Client from 6.8.1 to 7.0.0; target framework changed to net6.0
10.0.0 .NET 10 target, MS Extensions packages at 10.0.0
8.0.7 Removes channel pool in RpcClient; eliminates ChannelAllocationException root cause
8.0.6 Fixes channel-allocation leak introduced in 8.0.4
8.0.5 ⚠️ Deprecated — do not use. Channel leak.
8.0.4 ⚠️ Deprecated — do not use. Channel leak.
8.0.3-alpha Performance optimizations, channel pooling, .NET 8.0 support
8.0.2 Added out-of-the-box support for RabbitMQ round-robin dispatching
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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
10.0.1 6,244 6/19/2026
10.0.0 6,038 6/17/2026
8.0.7 14,218 6/16/2026
8.0.6 3,221 5/18/2026
8.0.5 927 5/13/2026
8.0.4 1,036 5/8/2026
8.0.4-beta 366 5/6/2026
8.0.3-alpha 1,645 2/13/2026
8.0.2 69,879 10/16/2024
8.0.2-alpha-3 185 10/15/2024
8.0.2-alpha-1 194 8/30/2024
8.0.1 4,846 8/30/2024
8.0.0 2,504 7/15/2024
7.0.3 5,974 1/11/2024
7.0.2 4,751 9/25/2023
7.0.1 1,512 11/25/2022
7.0.1-timeout.60 296 8/2/2023
7.0.0 526 11/9/2022
6.0.3 9,473 11/25/2022
6.0.2 1,050 8/10/2022
Loading failed