OptionalonconnectFires after a successful (re)connection and consumer recovery
OptionalonfailedFires when max retries are exhausted
Declare a direct exchange and return a session-bound AMQPExchange handle.
Optionalname: string = "amq.direct"exchange name
Optionalparams: ExchangeParamsOptionalargs: Record<string, unknown>Declare an exchange and return a session-bound AMQPExchange handle.
exchange name
exchange type: "direct", "fanout", "topic", "headers", or a custom type
Optionalparams: ExchangeParamsexchange declaration parameters
Optionalargs: Record<string, unknown>optional exchange arguments
Declare a fanout exchange and return a session-bound AMQPExchange handle.
Optionalname: string = "amq.fanout"exchange name
Optionalparams: ExchangeParamsOptionalargs: Record<string, unknown>Declare a headers exchange and return a session-bound AMQPExchange handle.
Optionalname: string = "amq.headers"exchange name
Optionalparams: ExchangeParamsOptionalargs: Record<string, unknown>Declare a queue and return a session-bound AMQPQueue handle.
The returned queue's subscribe uses auto-recovery and publish waits for
a broker confirm.
queue name (use "" to let the broker generate a name)
Optionalparams: QueueParamsqueue declaration parameters
Optionalargs: Record<string, unknown>optional queue arguments (e.g. x-message-ttl)
Perform an RPC call: publish a message and wait for the response. Creates a temporary client per call — simple and sufficient for most use cases.
For high-throughput scenarios where the per-call channel overhead matters, use rpcClient to create a reusable client instead.
The routing key / queue name of the RPC server
The request body
Optionaloptions: AMQPProperties & { timeout?: number }Optional AMQP properties and timeout
Optionaltimeout?: numberTimeout in milliseconds
The reply AMQPMessage
Create and start a reusable RPC client that keeps its channel open across multiple calls. Prefer rpcCall for simplicity; use this when you need to avoid the per-call channel overhead.
A started AMQPRPCClient ready for AMQPRPCClient.call invocations.
Create and start an RPC server that consumes from the given queue.
Each incoming message is passed to handler; the returned value is
published back to the caller's replyTo address.
Queue name to consume from
Callback that receives the message body and full message, returns the response body
Optionalprefetch: numberChannel prefetch count (default: 1)
A started AMQPRPCServer
Stop the session: cancel reconnection, clear consumer tracking, and close the underlying connection.
Optionalreason: stringDeclare a topic exchange and return a session-bound AMQPExchange handle.
Optionalname: string = "amq.topic"exchange name
Optionalparams: ExchangeParamsOptionalargs: Record<string, unknown>StaticconnectConnect to an AMQP broker and return a session with automatic reconnection.
The transport is chosen from the URL scheme:
amqp:// / amqps:// → TCP socket (AMQPClient)ws:// / wss:// → WebSocket (AMQPWebSocketClient)Optionaloptions: AMQPSessionOptions
High-level session with automatic reconnection and consumer recovery.
Create via
AMQPSession.connect(url, options).