Genkit JS API reference
    Preparing search index...

    Interface StreamManager

    Interface for managing streaming actions, allowing creation and subscription to streams. Implementations can provide different storage backends (e.g., in-memory, database, cache).

    interface StreamManager {
        open<S, O>(streamId: string): Promise<ActionStreamInput<S, O>>;
        subscribe<S, O>(
            streamId: string,
            options: ActionStreamSubscriber<S, O>,
        ): Promise<{ unsubscribe: () => void }>;
    }

    Implemented by

    Index

    Methods

    Methods

    • Opens a stream for writing.

      Type Parameters

      • S
      • O

      Parameters

      • streamId: string

        The unique identifier for the stream.

      Returns Promise<ActionStreamInput<S, O>>

      An object to write to the stream.

    • Subscribes to a stream to receive its events.

      Type Parameters

      • S
      • O

      Parameters

      Returns Promise<{ unsubscribe: () => void }>

      A promise resolving to an object containing an unsubscribe function.