Client SDKsC#Reference
RPC
API reference for KubeMQ commands and queries (RPC) in the C# SDK, covering SendCommandAsync and worker streaming helpers.
Commands and queries share CommandMessage/QueryMessage with async streaming helpers for workers.
Commands
SendCommandAsync
Task<CommandResponse> SendCommandAsync(CommandMessage message, CancellationToken ct = default);CommandMessage fields:
| Property | Type | Required | Description |
|---|---|---|---|
Channel | string | Yes | Target channel |
Body | ReadOnlyMemory<byte> | Conditional | Payload |
Metadata | string? | Conditional | Metadata |
TimeoutInSeconds | int? | No | RPC timeout in seconds; falls back to client default |
Tags | Dictionary<string, string>? | No | Tags |
SubscribeToCommandsAsync
IAsyncEnumerable<CommandReceived> SubscribeToCommandsAsync(
CommandsSubscription subscription, CancellationToken ct = default);SendCommandResponseAsync
await client.SendCommandResponseAsync(CommandResponse response, CancellationToken ct = default);Queries
SendQueryAsync
Task<QueryResponse> SendQueryAsync(QueryMessage message, CancellationToken ct = default);QueryMessage extends CommandMessage with:
| Property | Type | Description |
|---|---|---|
CacheKey | string? | Cache key |
CacheTtlSeconds | int? | Cache TTL in seconds |
SubscribeToQueriesAsync
IAsyncEnumerable<QueryReceived> SubscribeToQueriesAsync(
QueriesSubscription subscription, CancellationToken ct = default);SendQueryResponseAsync
await client.SendQueryResponseAsync(QueryResponse response, CancellationToken ct = default);Quick Usage
var response = await client.SendCommandAsync(new CommandMessage
{
Channel = "svc.commands",
Body = payload,
TimeoutInSeconds = 5,
});See Also
Was this page helpful?