KubeMQ
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:

PropertyTypeRequiredDescription
ChannelstringYesTarget channel
BodyReadOnlyMemory<byte>ConditionalPayload
Metadatastring?ConditionalMetadata
TagsDictionary<string, string>?NoTags

SubscribeToEventsAsync

IAsyncEnumerable<EventReceived> SubscribeToEventsAsync(
    EventsSubscription subscription, CancellationToken ct = default);

Returns an async stream of received events. Use await foreach to consume.

Quick Usage

Events.cs
await client.SendEventAsync(new EventMessage
{
    Channel = "events.demo",
    Body = new byte[] { 0x48, 0x69 },
});

See Also

Was this page helpful?

On this page