@lppedd/message-bus - v0.9.1
    Preparing search index...

    Interface LazyAsyncSubscription<T>

    Represents a lazily-initialized subscription to a Topic that is also an AsyncIterableIterator.

    The subscription supports consuming published messages using for await ... of, awaiting a single message via single, and manual disposal via dispose. If an async iteration completes or ends early (e.g., via break, return, or an error), the subscription is automatically disposed.

    The subscription is created lazily: the first call to next() or single() triggers the underlying registration. If the consumer never starts an iteration or never awaits a message, no subscription is created.

    interface LazyAsyncSubscription<T = unknown> {
        "[asyncIterator]"(): AsyncIterableIterator<T, any, any>;
        dispose(): void;
        next(...__namedParameters: [] | [any]): Promise<IteratorResult<T, any>>;
        return?(value?: any): Promise<IteratorResult<T, any>>;
        single(): Promise<T>;
        throw?(e?: any): Promise<IteratorResult<T, any>>;
    }

    Type Parameters

    • T = unknown

    Hierarchy (View Summary)

    Index

    Methods

    • Returns AsyncIterableIterator<T, any, any>

    • Disposes the subscription, unsubscribing from the topic.

      After disposal, the subscription will no longer receive messages.

      Returns void

    • Parameters

      • ...__namedParameters: [] | [any]

      Returns Promise<IteratorResult<T, any>>

    • Parameters

      • Optionalvalue: any

      Returns Promise<IteratorResult<T, any>>

    • Awaits the next message published to the topic.

      Throws an error if the subscription was disposed before a message was received.

      Returns Promise<T>

    • Parameters

      • Optionale: any

      Returns Promise<IteratorResult<T, any>>