Interface Stream<T>

A Stream provides access to listen to an (infinite) stream of items coming from a data source. Unlike [[Topic]], a Stream provides only access to read from the stream, not the ability to publish new items to the stream.

interface Stream<T> {
    subscribe(name, handler): void;
}

Type Parameters

  • T

    The type of items published to the stream.

Hierarchy (view full)

Methods

Methods

  • Subscribe to items published to this stream.

    Each subscription receives all items published to the stream. If a subscription handler returns a failed promise, the subscription handler may be retried some number of times. If no retry is successful, the item will be sent to the global error handler. Note that as a result, subscription handlers must ensure they can safely be retried.

    Parameters

    • name: string

      The name of the subscription.

    • handler: ((item) => Promise<void>)

      A callback to handle each item published to the stream.

        • (item): Promise<void>
        • Parameters

          • item: T

          Returns Promise<void>

    Returns void

Generated using TypeDoc