Interface StreamAPI

interface StreamAPI {
    add(cfg: Partial<StreamConfig>): Promise<StreamInfo>;
    delete(stream: string): Promise<boolean>;
    deleteMessage(stream: string, seq: number, erase?: boolean): Promise<boolean>;
    find(subject: string): Promise<string>;
    get(name: string): Promise<Stream>;
    getMessage(stream: string, query: MsgRequest): Promise<StoredMsg>;
    info(stream: string, opts?: Partial<StreamInfoRequestOptions>): Promise<StreamInfo>;
    list(subject?: string): Lister<StreamInfo>;
    names(subject?: string): Lister<string>;
    purge(stream: string, opts?: PurgeOpts): Promise<PurgeResponse>;
    update(name: string, cfg: Partial<StreamUpdateConfig>): Promise<StreamInfo>;
}

Methods

  • Adds a new stream with the specified stream configuration.

    Parameters

    Returns Promise<StreamInfo>

  • Deletes the specified stream

    Parameters

    • stream: string

    Returns Promise<boolean>

  • Deletes the specified message sequence from the stream

    Parameters

    • stream: string
    • seq: number
    • Optionalerase: boolean

      erase the message - by default true

    Returns Promise<boolean>

  • Find the stream that stores the specified subject.

    Parameters

    • subject: string

    Returns Promise<string>

  • Returns a Stream object

    Parameters

    • name: string

    Returns Promise<Stream>

  • Retrieves the message matching the specified query. Messages can be retrieved by sequence number or by last sequence matching a subject.

    Parameters

    Returns Promise<StoredMsg>

  • Returns the information about the specified stream

    Parameters

    Returns Promise<StreamInfo>

  • Lists all streams stored by JetStream

    Parameters

    • Optionalsubject: string

      only return streams that include the specified subject

    Returns Lister<StreamInfo>

  • Return a Lister of stream names

    Parameters

    • Optionalsubject: string

      if specified, the results are filtered to streams that contain the subject (can be wildcarded)

    Returns Lister<string>

  • Purges messages from a stream that match the specified purge options.

    Parameters

    Returns Promise<PurgeResponse>

  • Updates the stream configuration for the specified stream.

    Parameters

    Returns Promise<StreamInfo>