Skip to main content

Class: TopicHandle<T>

workflowStreamsClient.TopicHandle

Client-side handle for publishing to and subscribing from a single topic.

Constructed via WorkflowStreamClient.topic. Publishes share the underlying client's batching, dedup, and codec path; this object holds only the topic name and the type binding.

Type parameters

NameType
Tunknown

Properties

name

Readonly name: string

Methods

publish

publish(value, options?): void

Buffer value for publishing on this topic.

Equivalent to the underlying client's publish path; the value flows through the same buffer, batch interval, and dedup sequence.

Parameters

NameTypeDescription
valueIPayload | TValue to publish. Goes through the client's payload converter at flush time. A pre-built Payload bypasses conversion (zero-copy fast path), regardless of the handle's bound type.
options?Object-
options.forceFlush?booleanIf true, wake the flusher to send immediately (fire-and-forget — does not block the caller).

Returns

void


subscribe

subscribe(fromOffset?, options?): AsyncGenerator<WorkflowStreamItem<T>, void, unknown>

Async iterator over items on this topic, decoded as T via the client's configured payload converter (custom converter on the underlying Client flows through; otherwise the default).

For raw Payload access, or any other decode path that differs from the handle's bound T, call WorkflowStreamClient.subscribe directly — it yields WorkflowStreamItem.

Parameters

NameTypeDescription
fromOffset?numberGlobal offset to start reading from.
options?SubscribeOptions-

Returns

AsyncGenerator<WorkflowStreamItem<T>, void, unknown>