Client SDKsC#Reference
Events
API reference for KubeMQ events (async pub/sub) in the C# SDK, covering SendEventAsync and SubscribeToEventsAsync.
Events use SendEventAsync for publishers and SubscribeToEventsAsync for consumers, returning IAsyncEnumerable streams.
SendEventAsync
await client.SendEventAsync(EventMessage message, CancellationToken ct = default);EventMessage fields:
| Property | Type | Required | Description |
|---|---|---|---|
Channel | string | Yes | Target channel |
Body | ReadOnlyMemory<byte> | Conditional | Payload |
Metadata | string? | Conditional | Metadata |
Tags | Dictionary<string, string>? | No | Tags |
SubscribeToEventsAsync
IAsyncEnumerable<EventReceived> SubscribeToEventsAsync(
EventsSubscription subscription, CancellationToken ct = default);Returns an async stream of received events. Use await foreach to consume.
Quick Usage
await client.SendEventAsync(new EventMessage
{
Channel = "events.demo",
Body = new byte[] { 0x48, 0x69 },
});See Also
Was this page helpful?