import { ExtendedError } from '../../common/error';
import { OutboxOrInbox } from '../../common/listener-config';
import { TransactionalLogger } from '../../common/logger';
import { FullReplicationListenerConfig } from '../config';
/**
 * When some error is caught in the outbox or inbox listener this strategy will
 * allow you to log/track the error and potentially remove the underlying issue
 * e.g. if the replication slot does not exist after a database failover. It
 * returns the wait time until the listener should try to connect again.
 */
export interface ReplicationListenerRestartStrategy {
    /**
     * Check based on the error how long the listener should wait to restart.
     * @param error The caught error object (non Error type errors are wrapped)
     * @param logger The logger instance to use for logging the error.
     * @param outboxOrInbox The outbox or inbox name
     * @returns The time in milliseconds how long the listener should wait before restarting
     */
    (error: ExtendedError, logger: TransactionalLogger, outboxOrInbox: OutboxOrInbox): Promise<number>;
}
/**
 * The default listener restart strategy checks if the error is a PostgreSQL
 * error. If the PostgreSQL error is about the replication slot being in use, it
 * logs a trace entry and waits for the configured `restartDelaySlotInUseInMs`
 * time. Otherwise, it logs an error entry and waits for the configured
 * `restartDelayInMs`.
 */
export declare const defaultReplicationListenerRestartStrategy: (config: FullReplicationListenerConfig) => ReplicationListenerRestartStrategy;
/**
 * The default listener and slot restart strategy uses the same logic as the
 * `defaultListenerRestartStrategy`. In addition, it checks if a PostgreSQL error
 * is about the replication slot not existing (e.g. after a DB failover). Then
 * it tries to create the replication slot with the connection details of the
 * replication user slot and waits for the configured `restartDelayInMs`.
 */
export declare const defaultReplicationListenerAndSlotRestartStrategy: (config: FullReplicationListenerConfig) => ReplicationListenerRestartStrategy;
//# sourceMappingURL=listener-restart-strategy.d.ts.map