RabbitMQ implementation of RPC
License
—
Deps
4
Install Size
—
Vulns
✓ 0
Published
Feb 13, 2026
$ dotnet add package SwitchSoftware.Messaging.RPC.RabbitMQnuget repo : https://www.nuget.org/packages/SwitchSoftware.Messaging.RPC.RabbitMQ
undefined
There are also versions for .net core 6.0 and 5.0
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.
The server relies on the following app settings (adjust to your RabbitMQ instance):
"HostName": "localhost",
"Username": "guest",
"Password": "guest",
"VirtualHost": "/",
"RPC_CLIENT_TIME_OUT_IN_MILLISECONDS":60000
}
Note: RPC_CLIENT_TIME_OUT_IN_MILLISECONDS is optional. If not specified, the default time out value of 45000 ms is used.
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.
8.0.2 - Added out-of-the-box support for RabbitMQ round-robin dispatching