@nats-io/jetstream
    Preparing search index...

    Type Alias DirectStreamAPI

    The Direct stream API is a bit more performant for retrieving messages, but requires the stream to have enabled direct access. See StreamConfig.allow_direct.

    These APIs are intended to support other APIs in the library.

    Note that these APIs are marked as non-stable, this means that these APIs are subject to change.

    Note that these API can retrieve values from any replica, so it is possible for a lookup after an update to not include the message that was just added.

    type DirectStreamAPI = {
        getBatch(
            stream: string,
            opts: DirectBatchOptions,
        ): Promise<QueuedIterator<StoredMsg>>;
        getLastMessagesFor(
            stream: string,
            opts: DirectLastFor,
        ): Promise<QueuedIterator<StoredMsg>>;
        getMessage(stream: string, query: DirectMsgRequest): Promise<StoredMsg>;
    }
    Index
    • Retrieves a batch of messages with an optional filter starting at a specific sequence or start time. Note that only a single subject filter is supported. As with getMessage, if direct get can't answer, the iterator stops with a NoRespondersError.

      This API is Non-Stable and subject to change.

      Parameters

      Returns Promise<QueuedIterator<StoredMsg>>

    • Retrieves the last message for each subject in the filter. If no filter is specified, a maximum of 1024 subjects are returned. Care should be given on the specified filters to ensure that the results match what the client is expecting and to avoid missing expected data.

      This API is Non-Stable and subject to change.

      Parameters

      Returns Promise<QueuedIterator<StoredMsg>>

    • Retrieves the message matching the specified query. Messages can be retrieved by sequence number or by last sequence matching a subject, or by looking for the next message sequence that matches a subject. Resolves to null if the message is not found. Rejects with a NoRespondersError if direct get can't answer: JetStream is not enabled, the stream doesn't exist, or the stream doesn't allow direct get.

      This API is Non-Stable and subject to change.

      Parameters

      Returns Promise<StoredMsg>