Interface Topic<T>

A Topic is used to distribute work which will be run concurrently by any susbcribed handlers. Producers can [[publish]] to the topic, and consumers can [[subscribe]] to be notified when new items are published.

interface Topic<T> {
    publish: ((item) => Promise<void>);
    subscribe(name, handler): void;
}

Type Parameters

  • T

    The type of items published to the topic.

Hierarchy (view full)

Properties

Methods

Properties

publish: ((item) => Promise<void>)

Publish an item to this Topic.

Type declaration

    • (item): Promise<void>
    • Parameters

      • item: T

        The item to publish.

      Returns Promise<void>

Methods

  • Subscribe to items published to this topic.

    Each subscription receives all items published to the topic.

    Parameters

    • name: string

      The name of the subscription.

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

      A callback to handle each item published to the topic.

        • (item): Promise<void>
        • Parameters

          • item: T

          Returns Promise<void>

    Returns void

Generated using TypeDoc