Aid.Microservice.Client 2.3.0

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

Aid.Microservice.Client

A lightweight RPC client library for communicating with Aid.Microservice services over RabbitMQ.

Quick Start

await using var factory = new RpcClientFactory("localhost", 5672, "guest", "guest");

// Create a client bound to a specific service
await using var client = factory.CreateClient("simple");

// Make a call
var result = await client.CallAsync<int>("multiple", new { a = 5, b = 10 });
Console.WriteLine(result);

API

IRpcClientFactory

The factory manages a single RabbitMQ connection and creates lightweight clients on demand.

// Default protocol (DefaultJsonProtocol)
IRpcClient CreateClient(string serviceName);

// Custom protocol (exchange taken from protocol's DefaultExchangeName)
IRpcClient CreateClient(string serviceName, IRpcProtocol protocol);

// Custom protocol with explicit exchange name
IRpcClient CreateClient(string serviceName, IRpcProtocol protocol, string exchangeName);

IRpcClient

// Call with return type
Task<T?> CallAsync<T>(string method, object? parameters = null, TimeSpan? timeout = null, CancellationToken ct = default);

// Call without return type (fire-and-forget style)
Task CallAsync(string method, object? parameters = null, TimeSpan? timeout = null, CancellationToken ct = default);
Parameter Required Default Description
method Yes Method name (as defined by [RpcCallable] or its alias)
parameters No null Anonymous object with named arguments
timeout No 30s Call timeout
cancellationToken No Cancellation token

Protocols

Default Protocol

var client = factory.CreateClient("simple");
// Uses DefaultJsonProtocol on "aid_rpc" exchange

Nameko Protocol (Python Interop)

using Aid.Microservice.Shared.Protocols;

var namekoClient = factory.CreateClient("python_service", new NamekoProtocol());
// Uses NamekoSerializer on "nameko-rpc" exchange

Mixed Service — Different Protocols

// Same service, different methods on different exchanges
var namekoClient = factory.CreateClient("mixed_service", new NamekoProtocol());
var namekoResult = await namekoClient.CallAsync<int>("nameko_add", new { a = 10, b = 20 });

var defaultClient = factory.CreateClient("mixed_service");
var defaultResult = await defaultClient.CallAsync<int>("default_add", new { a = 100, b = 200 });

Clients are cached by (serviceName, protocol, exchangeName) — repeated calls with the same parameters reuse the same instance.

Passing Arguments

Named Arguments (kwargs)

Default — pass an anonymous object:

await client.CallAsync("add", new { a = 1, b = 2 });
// → {"Method": "add", "Parameters": {"a": 1, "b": 2}}

Positional Arguments (args) — Nameko

Use RpcNamekoRequest for Nameko-compatible services:

// args: [10, 20]
await client.CallAsync("sum", new RpcNamekoRequest(10, 20));

// args=['pdf'], kwargs={'async': true}
await client.CallAsync("generate",
    new RpcNamekoRequest(
        args: new object[] { "pdf" },
        kwargs: new { async = true }
    )
);

Error Handling

try
{
    var result = await client.CallAsync<int>("method", new { a = 1 });
}
catch (RpcCallException ex)
{
    // Server-side error — contains error message, type, and CorrelationId
    Console.WriteLine($"RPC Error: {ex.Message}");
}
catch (TimeoutException)
{
    // Call timed out (default: 30s)
    Console.WriteLine("Call timed out");
}

Configuration

Constructor Overloads

// Simple
new RpcClientFactory("localhost", 5672, "guest", "guest");

// With explicit exchange and protocol
new RpcClientFactory("localhost", 5672, "guest", "guest",
    exchangeName: "my_rpc",
    protocol: new NamekoProtocol());

// From configuration object
var config = new RabbitMqConfiguration { ... };
new RpcClientFactory(config);

RabbitMQ Options

Option Default Description
ExchangeName (per-protocol) Global exchange override.
RetryCount 3 Reconnection attempts.
RecoveryInterval 5 Seconds between retries.
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 (2)

Showing the top 2 NuGet packages that depend on Aid.Microservice.Client:

Package Downloads
Aid.Microservice.Client.AspNetCore

ASP.NET Core integration for Aid.Microservice RPC client. Provides DI-based registration with a shared connection pool for web applications.

Aid.Microservice.Server

A .NET library for building RPC microservices over RabbitMQ with support for multiple protocols and per-method serializers. Features declarative attributes, DI, async/await, and Nameko (Python) interoperability.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.3.0 112 4/11/2026
2.2.0 117 4/10/2026
2.1.0 137 12/28/2025
2.0.0 130 12/28/2025
1.0.1 312 7/20/2025
1.0.0 138 7/19/2025