Interface JetStreamPublishOptions

Options for messages published to JetStream

interface JetStreamPublishOptions {
    expect: Partial<{
        lastMsgID: string;
        lastSequence: number;
        lastSubjectSequence: number;
        streamName: string;
    }>;
    headers: MsgHdrs;
    msgID: string;
    timeout: number;
}

Properties

expect: Partial<{
    lastMsgID: string;
    lastSequence: number;
    lastSubjectSequence: number;
    streamName: string;
}>

Set of constraints that when specified are verified by the server. If the constraint(s) doesn't match, the server will reject the message. These settings allow you to implement deduplication and consistency strategies.

Type declaration

  • lastMsgID: string

    The expected last msgID of the last message received by the stream.

  • lastSequence: number

    The expected last sequence on the stream.

  • lastSubjectSequence: number

    The expected last sequence on the stream for a message with this subject

  • streamName: string

    The expected stream capturing the message

headers: MsgHdrs

Headers associated with the message. You can create an instance of MsgHdrs with the headers() function.

msgID: string

A string identifier used to detect duplicate published messages. If the msgID is reused within the stream's duplicate_window, the message will be rejected by the stream, and the PubAck will mark it as a duplicate.

timeout: number

The number of milliseconds to wait for the PubAck