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
<PackageReference Include="SwitchSoftware.Messaging.RPC.RabbitMQ" Version="10.0.1" />
<PackageVersion Include="SwitchSoftware.Messaging.RPC.RabbitMQ" Version="10.0.1" />
<PackageReference Include="SwitchSoftware.Messaging.RPC.RabbitMQ" />
paket add SwitchSoftware.Messaging.RPC.RabbitMQ --version 10.0.1
#r "nuget: SwitchSoftware.Messaging.RPC.RabbitMQ, 10.0.1"
#:package SwitchSoftware.Messaging.RPC.RabbitMQ@10.0.1
#addin nuget:?package=SwitchSoftware.Messaging.RPC.RabbitMQ&version=10.0.1
#tool nuget:?package=SwitchSoftware.Messaging.RPC.RabbitMQ&version=10.0.1
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 neednetstandard2.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:
PortandRPC_CLIENT_TIME_OUT_IN_MILLISECONDSare optional. The default timeout is 45 000 ms.⚠️ Breaking change from 8.0.3-alpha: The config key was renamed from
UsernametoUserName(capital N). Update yourappsettings.jsonaccordingly.
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.
Dead-letter exchange (recommended for 8.0.4+)
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
ChannelAllocationExceptionregression introduced in 8.0.4:RpcClientno longer over-releases its concurrency semaphore whenWaitAsyncis cancelled, which previously allowed unbounded concurrent channel creation on the underlying connection.RpcClientnow 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 | Versions 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. |
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.0)
- RabbitMQ.Client (>= 7.0.0)
- SwitchSoftware.Messaging.RPC (>= 2.1.0)
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 |