KubeMQ
Client SDKsNode.jsReference

Events

Fire-and-forget pub/sub — KubeMQ Node.js SDK reference.

Publish with sendEvent and consume through subscribeToEvents, passing strongly typed subscription options.

sendEvent

await client.sendEvent(message: EventMessage): Promise<void>

Parameters:

NameTypeRequiredDescription
messageEventMessageYesChannel, body, metadata, tags

Returns: Promise<void> — resolves when the broker accepts the message.

subscribeToEvents

client.subscribeToEvents(subscription: EventsSubscription): Subscription

EventsSubscription:

FieldTypeRequiredDescription
channelstringYesChannel name
groupstringNoConsumer group
onEvent(event) => voidYesDelivery handler
onError(err) => voidYesError handler

Returns: Subscription — call cancel() to stop.

Quick Usage

events.ts
await client.sendEvent(
  createEventMessage({ channel: "events.demo", body: Buffer.from("hello") }),
);

See Also

Was this page helpful?

On this page