Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

SubOpts

import type { SubOpts } from "https://raw.githubusercontent.com/nats-io/nats.deno/v1.27.0/nats-base-client/internal_mod.ts";

Subscription Options

interface SubOpts <T> {
callback?: (err: NatsError | null, msg: T) => void;
max?: number;
queue?: string;
timeout?: number;
}

§Type Parameters

§Properties

§
callback?: (err: NatsError | null, msg: T) => void
[src]

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
[src]

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

§
queue?: string
[src]

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

§
timeout?: number
[src]

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.