@cloudamqp/amqp-client
    Preparing search index...

    Class AMQPSession

    High-level session with automatic reconnection and consumer recovery.

    Create via AMQPSession.connect(url, options). The session owns its underlying transport; use session.client only to inspect state, not to open channels directly.

    Index

    Properties

    client: AMQPBaseClient

    Underlying transport. Exposed for state inspection (e.g. client.closed) and test access. Do not open channels on this directly, and do not overwrite client.ondisconnect — the session uses it to drive reconnection.

    onconnect?: () => void

    Fires after a successful (re)connection and consumer recovery

    onfailed?: (error?: Error) => void

    Fires when max retries are exhausted

    Methods

    • Stop the session: cancel reconnection, clear consumer tracking, and close the underlying connection.

      Parameters

      • Optionalreason: string

      Returns Promise<void>

    • Connect 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)

      Parameters

      Returns Promise<AMQPSession>