Interface JsMsg

Represents a message stored in JetStream

Hierarchy

  • JsMsg

Properties

data: Uint8Array

The message's data

headers: MsgHdrs

Any headers associated with the message

The delivery info for the message

redelivered: boolean

True if the message was redelivered

seq: number

The sequence number for the message

subject: string

The subject on which the message was published

Methods

  • Indicate to the JetStream server that the message was processed successfully.

    Returns void

  • Indicate to the JetStream server that the message was processed successfully and that the JetStream server should acknowledge back that the acknowledgement was received.

    Returns Promise<boolean>

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

    Type Parameters

    • T

    Returns T

  • Indicate to the JetStream server that processing of the message failed, and that it should be resent after the spefied number of milliseconds.

    Parameters

    • Optional millis: number

    Returns void

  • !! this is an experimental feature - and could be removed

    next() combines ack() and pull(), requires the subject for a subscription processing to process a message is provided (can be the same) however, because the ability to specify how long to keep the request open can be specified, this functionality doesn't work well with iterators, as an error (408s) are expected and needed to re-trigger a pull in case there was a timeout. In an iterator, the error will close the iterator, requiring a subscription to be reset.

    Parameters

    Returns void

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

    Returns string

  • Indicate to the JetStream server that processing of the message failed and that the message should not be sent to the consumer again.

    Parameters

    • Optional reason: string

      is a string describing why the message was termed. Note that reason is only available on servers 2.11.0 or better.

    Returns void

  • Indicate to the JetStream server that processing of the message is on going, and that the ack wait timer for the message should be reset preventing a redelivery.

    Returns void

Generated using TypeDoc