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

    Interface SubOpts<T>

    Subscription Options

    interface SubOpts<T> {
        callback?: MsgCallback<T>;
        max?: number;
        queue?: string;
        slow?: number;
        timeout?: number;
    }

    Type Parameters

    • T
    Index

    Properties

    callback?: MsgCallback<T>

    An optional function that will handle messages. Typically, messages are processed via an async iterator on the subscription. If this option is provided, messages are processed by the specified function.

    max?: number

    Optional maximum number of messages to deliver to the subscription before it is auto-unsubscribed.

    queue?: string

    Optional queue name (subscriptions on the same subject that use queues are horizontally load balanced when part of the same queue).

    slow?: number

    Number of pending messages in a subscription to exceed prior to considering a subscription a Slow Consumer. By default, slow consumer is on a subscription is not accounted for.

    This is an experimental option.

    timeout?: number

    Optional maximum number of milliseconds before a timer raises an error. This useful to monitor a subscription that is expected to yield messages. The timer is cancelled when the first message is received by the subscription.