RabbitRpc.Server 4.0.1

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

RabbitRpc.Server

Server-side library for RabbitMQ RPC on .NET 10. Register implementations of contract interfaces with DI; a hosted service listens on the configured RabbitMQ route and dispatches each incoming request to the matching method.

v4.0 introduces a pluggable serialization layer — you must pair this package with one of the adapter packages:

Installation

dotnet add package RabbitRpc.Server
dotnet add package RabbitRpc.Serialization.XPacketRpc      # or .MemoryPack / .SystemTextJson

Pack for NuGet

dotnet pack -c Release

Configuration

Add the RabbitMqRpc section to appsettings.json:

{
  "RabbitMqRpc": {
    "HostName": "localhost",
    "Port": 5672,
    "VirtualHost": "/",
    "UserName": "guest",
    "Password": "guest",
    "ClientProvidedName": "rabbit-rpc-server",
    "RoutePrefix": "rpc.",
    "PrefetchCount": 1,
    "ConsumerDispatchConcurrency": null,
    "DefaultTimeoutSeconds": 30
  }
}

ConsumerDispatchConcurrency defaults to PrefetchCount; handlers must be thread-safe when it is > 1. Set it to 1 for the v3.0 sequential-dispatch behaviour.

Usage

Define a contract interface (shared between client and server) and implement it on the server:

public interface IMathService
{
    Task<int>     AddAsync(int a, int b);
    Task<UserDto> GetUserAsync(Guid id);
}

public sealed class MathService : IMathService
{
    public Task<int>     AddAsync(int a, int b) => Task.FromResult(a + b);
    public Task<UserDto> GetUserAsync(Guid id)  => Task.FromResult(new UserDto(id, "Alice"));
}

Register the server and handlers in Program.cs:

using AsbtCore.Broker.Server;
using AsbtCore.Broker.Serialization.XPacketRpc;   // pick one adapter

var builder = Host.CreateApplicationBuilder(args);

builder.Services
    .AddRabbitRpcServer(builder.Configuration)    // returns RpcServerBuilder
    .UseXPacketRpcSerialization()                 // required in v4.0
    .Register<IMathService, MathService>();

await builder.Build().RunAsync();

The hosted service declares one durable queue per RPC route (rpc.<InterfaceFullName>), one companion dead-letter queue (<route>.dead), and starts consuming. Server-side exceptions are serialized and rethrown on the client as RpcRemoteException. Poison messages (deserialization failure, unresolvable type, dispatcher error) are routed to the DLQ after a single attempt — no requeue loops; monitor *.dead depth for alerting.

Migration v3.x → v4.0

Was (v3.x) Now (v4.0)
AddRabbitRpcServer(cfg) returns RpcServerBuilder, defaults JSON returns RpcServerBuilder, NO default serializer
services.AddRpcSerialization() builder.UseXxxSerialization() from an adapter package
JsonElement result in RpcResponse ReadOnlyMemory<byte>?
RpcRequestDispatcher ctor with 2 args ctor takes IRpcSerializer as a third parameter

Startup throws OptionsValidationException with a helpful message if no IRpcSerializer is registered. See the repo migration guide for the full break list.

See Also

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
4.0.1 90 5/20/2026
4.0.0 88 5/15/2026
3.0.0 103 5/7/2026
1.0.2 94 4/15/2026
1.0.1 93 4/14/2026
1.0.0 99 4/14/2026

v4.0.1 — Binary serialization. MINOR UPDATE.
- Wire format is incompatible with v3.x. Roll forward client and server together.
- A serialization adapter package is now REQUIRED: install either
 RabbitRpc.Serialization.XPacketRpc (binary, default) or
 RabbitRpc.Serialization.SystemTextJson (JSON, drop-in v3 compat shape).
- DI now requires '.UseXPacketRpcSerialization()' / '.UseJsonRpcSerialization()' on
 the builder returned by 'AddRabbitRpcServer(cfg)'. Startup throws if missing.
- 'RpcRequest.Arguments[i].Payload' / 'RpcResponse.Result' changed from
 'JsonElement' to 'ReadOnlyMemory<byte>'.
- 'IRpcSerializer' surface widened to four methods. Custom implementations must update.
See README "Migration v3.1 → v4.0".