bunqueue v2.8 API referenceall versions · guide
bunqueue
    Preparing search index...

    Class TcpConnectionPool

    Connection pool for parallel TCP operations Load-aware distribution - prefers connected clients with capacity

    Index
    • Increment reference count (for shared pools)

      Returns void

    • Connect all clients in pool

      Returns Promise<void>

    • Get number of connected clients

      Returns number

    • Get aggregated health metrics for the pool

      Returns {
          avgLatencyMs: number;
          clients: ConnectionHealth[];
          connectedCount: number;
          healthy: boolean;
          totalCommands: number;
          totalCount: number;
          totalErrors: number;
      }

    • Check if any connection is ready

      Returns boolean

    • Invoke cb whenever a pooled connection (re)establishes. TcpClient emits 'connected' on every successful connect, including reconnects. Used by Worker to re-register after a reconnect (the server drops registration when the registering connection closes and each reconnect gets a fresh clientId).

      Parameters

      • cb: () => void

      Returns void

    • Decrement reference count and close if zero

      Returns void

    • Send command using next available connection

      Parameters

      • command: Record<string, unknown>

      Returns Promise<Record<string, unknown>>

    • Send multiple commands in parallel across pool

      Parameters

      • commands: Record<string, unknown>[]

      Returns Promise<Record<string, unknown>[]>

    • Set pool key for shared pool cleanup

      Parameters

      • key: string

      Returns void