import { Pool } from 'pg'; import type { JobNotification, NotificationChannelConfig, JobStateNotification } from 'agenda'; import { BaseNotificationChannel } from 'agenda'; /** * Configuration for PostgresNotificationChannel */ export interface PostgresNotificationChannelConfig extends NotificationChannelConfig { /** PostgreSQL connection pool (shared with repository) */ pool?: Pool; /** PostgreSQL connection string (if not sharing pool) */ connectionString?: string; } /** * PostgreSQL notification channel using LISTEN/NOTIFY * * This implementation uses PostgreSQL's built-in pub/sub mechanism * for real-time job notifications across multiple processes. */ export declare class PostgresNotificationChannel extends BaseNotificationChannel { private pool?; private ownPool; private connectionString?; private listenClient?; /** State channel name (derived from main channel name) */ private get stateChannelName(); constructor(config?: PostgresNotificationChannelConfig); /** * Set the pool (used when created by PostgresBackend) */ setPool(pool: Pool): void; connect(): Promise; private handleConnectionLoss; disconnect(): Promise; publish(notification: JobNotification): Promise; publishState(notification: JobStateNotification): Promise; /** * Serialize notification to JSON string for NOTIFY payload */ private serializeNotification; /** * Serialize state notification to JSON string for NOTIFY payload */ private serializeStateNotification; /** * Parse notification from JSON string received via LISTEN */ private parseNotification; /** * Parse state notification from JSON string received via LISTEN */ private parseStateNotification; }