SwitchSoftware.Messaging.RPC.RabbitMQ
8.0.6
dotnet add package SwitchSoftware.Messaging.RPC.RabbitMQ --version 8.0.6
NuGet\Install-Package SwitchSoftware.Messaging.RPC.RabbitMQ -Version 8.0.6
<PackageReference Include="SwitchSoftware.Messaging.RPC.RabbitMQ" Version="8.0.6" />
<PackageVersion Include="SwitchSoftware.Messaging.RPC.RabbitMQ" Version="8.0.6" />
<PackageReference Include="SwitchSoftware.Messaging.RPC.RabbitMQ" />
paket add SwitchSoftware.Messaging.RPC.RabbitMQ --version 8.0.6
#r "nuget: SwitchSoftware.Messaging.RPC.RabbitMQ, 8.0.6"
#:package SwitchSoftware.Messaging.RPC.RabbitMQ@8.0.6
#addin nuget:?package=SwitchSoftware.Messaging.RPC.RabbitMQ&version=8.0.6
#tool nuget:?package=SwitchSoftware.Messaging.RPC.RabbitMQ&version=8.0.6
Switch Software RPC implementation for RabbitMQ
⚠️ Important: Versions 8.0.4 and 8.0.5 contain a channel-leak regression in
RpcClientthat causesRabbitMQ.Client.Exceptions.ChannelAllocationException(The connection cannot support any more channels) under sustained RPC load. Please upgrade to 8.0.6 or later. See the CHANGELOG for details.
Installation
nuget repo : https://www.nuget.org/packages/SwitchSoftware.Messaging.RPC.RabbitMQ
There are also versions for .net core 6.0 and 5.0
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 |
|---|---|
| 8.0.6 | Fixes channel-allocation leak introduced in 8.0.4: corrected concurrency-semaphore release on cancellation and cancel reply-queue consumer before returning channel to pool |
| 8.0.5 | ⚠️ Deprecated — do not use. Channel leak causes ChannelAllocationException under load. Upgrade to 8.0.6. |
| 8.0.4 | ⚠️ Deprecated — do not use. Channel leak causes ChannelAllocationException under load. Upgrade to 8.0.6. |
| 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 | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. 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. net9.0 was computed. 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. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- RabbitMQ.Client (>= 6.8.1)
- 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 |
|---|---|---|
| 8.0.6 | 2,005 | 5/18/2026 |
| 8.0.5 | 900 | 5/13/2026 |
| 8.0.4 | 1,007 | 5/8/2026 |
| 8.0.4-beta | 346 | 5/6/2026 |
| 8.0.3-alpha | 868 | 2/13/2026 |
| 8.0.2 | 56,505 | 10/16/2024 |
| 8.0.2-alpha-3 | 173 | 10/15/2024 |
| 8.0.2-alpha-1 | 182 | 8/30/2024 |
| 8.0.1 | 4,825 | 8/30/2024 |
| 8.0.0 | 2,479 | 7/15/2024 |
| 7.0.3 | 5,953 | 1/11/2024 |
| 7.0.2 | 4,736 | 9/25/2023 |
| 7.0.1 | 749 | 11/25/2022 |
| 7.0.1-timeout.60 | 283 | 8/2/2023 |
| 7.0.0 | 510 | 11/9/2022 |
| 6.0.3 | 9,461 | 11/25/2022 |
| 6.0.2 | 1,032 | 8/10/2022 |
| 6.0.0 | 7,543 | 5/24/2022 |
| 5.0.0 | 635 | 5/24/2022 |
| 3.1.24 | 621 | 5/24/2022 |