Type Alias StoredMsg

StoredMsg: {
    data: Uint8Array;
    header: MsgHdrs;
    lastSequence: number;
    pending: number;
    seq: number;
    subject: string;
    time: Date;
    timestamp: string;
    json<T>(reviver?: ReviverFn): T;
    string(): string;
}

A type representing a message that retrieved directly from JetStream.

Type declaration

  • data: Uint8Array

    The payload of the message body

  • header: MsgHdrs

    Headers for the message

  • lastSequence: number

    The previous sequence delivered to the client in the current batch. This value will be 0 if it was not from a batch request

  • pending: number

    The number of messages in the stream that are pending for a similar batch request. if -1, the number of pending messages is unknown and the stored message was received outside the context of a batch

  • seq: number

    The sequence number of the message in the Stream

  • subject: string

    The subject the message was originally received on

  • time: Date

    The time the message was received

  • timestamp: string

    The raw ISO formatted date returned by the server

  • json:function
    • Convenience method to parse the message payload as JSON. This method will throw an exception if there's a parsing error;

      Type Parameters

      • T

      Parameters

      • Optionalreviver: ReviverFn

      Returns T

  • string:function
    • Convenience method to parse the message payload as string. This method may throw an exception if there's a conversion error

      Returns string