rabbitmq-client
Version:
Robust, typed, RabbitMQ (0-9-1) client library
58 lines (57 loc) • 2.66 kB
TypeScript
import { TcpSocketConnectOpts } from 'node:net';
import type { ConnectionOptions as TLSOptions } from 'node:tls';
export interface ConnectionOptions {
/** Milliseconds to wait before aborting a Channel creation attempt, i.e. acquire()
* @default 20_000*/
acquireTimeout?: number;
/** Custom name for the connection, visible in the server's management UI */
connectionName?: string;
/** Max wait time, in milliseconds, for a connection attempt
* @default 10_000*/
connectionTimeout?: number;
/** Max size, in bytes, of AMQP data frames. Protocol max is
* 2^32-1. Actual value is negotiated with the server.
* @default 8192 */
frameMax?: number;
/** Period of time, in seconds, after which the TCP connection
* should be considered unreachable. Server may have its own max value, in
* which case the lowest of the two is used. A value of 0 will disable this
* feature. Heartbeats are sent every `heartbeat / 2` seconds, so two missed
* heartbeats means the connection is dead.
* @default 60 */
heartbeat?: number;
/** Maximum active AMQP channels. 65535 is the protocol max.
* The server may also have a max value, in which case the lowest of the two
* is used.
* @default 2047 */
maxChannels?: number;
/** Max delay, in milliseconds, for exponential-backoff when reconnecting
* @default 30_000 */
retryHigh?: number;
/** Step size, in milliseconds, for exponential-backoff when reconnecting
* @default 1000*/
retryLow?: number;
/** May also include params: heartbeat, connection_timeout, channel_max
* @default "amqp://guest:guest@localhost:5672"
*/
url?: string;
hostname?: string;
port?: string | number;
vhost?: string;
password?: string;
username?: string;
/** Enable TLS, or set TLS specific options like overriding the CA for
* self-signed certificates. Automatically enabled if url starts with
* "amqps:" */
tls?: boolean | TLSOptions;
/** Additional options when creating the TCP socket with net.connect(). */
socket?: TcpSocketConnectOpts;
/** Disable {@link https://en.wikipedia.org/wiki/Nagle's_algorithm | Nagle's
* algorithm} for reduced latency. Disabling Nagle’s algorithm will enable the
* application to have many small packets in flight on the network at once,
* instead of a smaller number of large packets, which may increase load on
* the network, and may or may not benefit the application performance. */
noDelay?: boolean;
/** "hostname:port" of multiple nodes in a cluster */
hosts?: string[];
}