Abstract class for creating connections to different backend providers. All implementations should extend this class and implement the following steps:

  1. Add the provider to ./providers/.ts
  2. Update ./factory.ts to reference the provider
  3. Register the tag with the Provider type in ./types/provider.ts.
  4. Create the specific provider type file at ./types/.ts
  5. Update ./modules/utils.ts (identifyProvider) with logic to resolve the provider by inspecting the class/import

Hierarchy (view full)

Constructors

Properties

connection: any = null
defaultOptions: PostgresClientOptions = ...
id: string = null
poolClientInstance: PostgresPoolClientType
connectionInstances: Set<PostgresClientType> = ...
disconnecting: boolean = false
instances: Map<string, AbstractConnection<ProviderClass, ProviderOptions>> = ...
logger: ILogger = ...
poolClientInstances: Set<PostgresPoolClientType> = ...
taskQueueConnections: Map<string, ConnectorPostgres> = ...

Methods

  • Get comprehensive connection statistics for monitoring taskQueue pooling effectiveness

    Returns {
        taskQueueConnections: number;
        taskQueueDetails: {
            connectionId: string;
            key: string;
            reusedCount: number;
        }[];
        totalConnections: number;
        totalPoolClients: number;
    }

    • taskQueueConnections: number
    • taskQueueDetails: {
          connectionId: string;
          key: string;
          reusedCount: number;
      }[]
    • totalConnections: number
    • totalPoolClients: number
  • Gets or creates a PostgreSQL connection based on taskQueue and database configuration. If a connection already exists for the same taskQueue + config, it will be reused. This optimization reduces connection overhead for PostgreSQL providers.

    Parameters

    • id: string
    • taskQueue: string
    • clientConstructor: PostgresClassType
    • options: PostgresClientOptions
    • config: {
          connect?: boolean;
          provider?: string;
      } = {}
      • Optionalconnect?: boolean
      • Optionalprovider?: string

    Returns Promise<ConnectorPostgres>

  • Check taskQueue pooling effectiveness - returns metrics about connection reuse

    Returns {
        averageReusesPerPool: number;
        poolingEfficiency: number;
        taskQueuePools: number;
        totalConnections: number;
        totalReuses: number;
    }

    • averageReusesPerPool: number
    • poolingEfficiency: number
    • taskQueuePools: number
    • totalConnections: number
    • totalReuses: number