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
| Name | Type |
|---|---|
T | unknown |
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
| Name | Type | Description |
|---|---|---|
value | IPayload | T | Value 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? | boolean | If 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
| Name | Type | Description |
|---|---|---|
fromOffset? | number | Global offset to start reading from. |
options? | SubscribeOptions | - |
Returns
AsyncGenerator<WorkflowStreamItem<T>, void, unknown>