Aid.Microservice.Shared
2.3.0
dotnet add package Aid.Microservice.Shared --version 2.3.0
NuGet\Install-Package Aid.Microservice.Shared -Version 2.3.0
<PackageReference Include="Aid.Microservice.Shared" Version="2.3.0" />
<PackageVersion Include="Aid.Microservice.Shared" Version="2.3.0" />
<PackageReference Include="Aid.Microservice.Shared" />
paket add Aid.Microservice.Shared --version 2.3.0
#r "nuget: Aid.Microservice.Shared, 2.3.0"
#:package Aid.Microservice.Shared@2.3.0
#addin nuget:?package=Aid.Microservice.Shared&version=2.3.0
#tool nuget:?package=Aid.Microservice.Shared&version=2.3.0
Aid.Microservice.Shared
Shared models, attributes, and protocols for the Aid.Microservice ecosystem.
This package is referenced by both Aid.Microservice.Server and Aid.Microservice.Client and does not need to be installed directly in most cases.
Attributes
[Microservice]
Marks a class as an RPC service.
[Microservice] // name: class name without "Service" suffix
[Microservice("custom_name")] // explicit name
[Microservice(SerializerType = typeof(NamekoSerializer))] // per-service serializer
[Microservice(ExchangeName = "my_rpc")] // explicit exchange
[Microservice(Exchanges = ["aid_rpc", "nameko-rpc"])] // multiple exchanges
[RpcCallable]
Marks a method as an RPC endpoint.
[RpcCallable] // name: method name (lowercase)
[RpcCallable("alias")] // explicit name
[RpcCallable(SerializerType = typeof(NamekoSerializer))] // per-method serializer
Protocols
IRpcProtocol
Defines the messaging protocol (exchange type, exchange name, serializer).
| Property | Description |
|---|---|
ExchangeType |
RabbitMQ exchange type (Topic, Direct, etc.) |
DefaultExchangeName |
Suggested exchange name |
DefaultSerializer |
IRequestSerializer used for message body |
Built-in implementations:
DefaultJsonProtocol— .NET ↔ .NET (Topic,aid_rpc)NamekoProtocol— .NET ↔ Python Nameko (Topic,nameko-rpc)
IRequestSerializer
Handles serialization/deserialization of RPC message bodies.
| Member | Description |
|---|---|
ContentType |
MIME type (e.g. application/json) |
ExchangeName |
Suggested exchange name for this serializer |
CreateRequest() |
Serialize request body |
ParseRequest() |
Deserialize incoming request |
CreateResponse() |
Serialize response body |
ParseResponse() |
Deserialize response body |
Built-in implementations:
DefaultJsonSerializer—{"Method": "...", "Parameters": {...}}NamekoSerializer—{"args": [...], "kwargs": {...}, "context_data": {...}}
Models
RpcRequest
Parsed incoming request.
public record RpcRequest
{
public string Method { get; init; }
public Dictionary<string, JsonElement>? Parameters { get; init; }
}
RpcResponse
RPC call result.
public record RpcResponse
{
public object? Result { get; init; }
public RpcError? Error { get; set; }
public bool IsSuccess => Error == null;
}
RpcError
Error details from server-side execution.
public record RpcError
{
public string Message { get; }
public string? StackTrace { get; }
public string? ErrorType { get; }
}
RpcNamekoRequest
Wrapper for sending positional arguments to Nameko-compatible services.
new RpcNamekoRequest(1, 2, 3) // args only
new RpcNamekoRequest(args: [1, 2], kwargs: new { x = 10 }) // both
Configuration
RabbitMqConfiguration
public class RabbitMqConfiguration
{
public string Hostname { get; set; } = "localhost";
public int Port { get; set; } = 5672;
public string Username { get; set; } = "guest";
public string Password { get; set; } = "guest";
public string? ExchangeName { get; set; }
public int RetryCount { get; set; } = 3;
public int RecoveryInterval { get; set; } = 5;
}
| 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.Logging.Abstractions (>= 10.0.1)
- Microsoft.Extensions.Options (>= 10.0.1)
- RabbitMQ.Client (>= 7.2.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Aid.Microservice.Shared:
| Package | Downloads |
|---|---|
|
Aid.Microservice.Client
A lightweight RPC client library for communicating with Aid.Microservice services over RabbitMQ. Supports multiple protocols (including Nameko/Python), per-client serializers, and efficient connection pooling. |
|
|
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.