import { EventEnvelope } from './interfaces';
export declare enum ExceptionResolution {
    Ignore = 0,
    Abort = 1,
    Retry = 2
}
export declare class NoSuchPositionException extends Error {
}
interface Subscription {
    unsubscribe(): void;
}
export declare type HandleException = (subscription: Subscription | undefined, error: Error, attempts: number) => Promise<ExceptionResolution>;
export declare type HandleSuccess = (subscription: Subscription) => Promise<void>;
export declare type CreateSubscription = (lastCheckpoint: bigint, handler: Handler, subscriptionId: string) => Promise<Subscription>;
export interface SubscriptionOptions {
    id: string;
    restartWhenAhead: boolean;
    beforeRestarting: () => Promise<void>;
}
declare type Handler = (event: EventEnvelope) => Promise<void>;
export declare class Dispatcher {
    private readonly createSubscription;
    private static readonly abortExceptionResolutionPromise;
    constructor(createSubscription: CreateSubscription);
    subscribe(lastProcessedCheckpoint: bigint, handler: Handler, options?: Partial<SubscriptionOptions>): Promise<Subscription>;
    exceptionHandler: HandleException;
    successHandler: HandleSuccess;
    private handleEvent;
    private handleUnknownCheckpoint;
    private executeWithPolicy;
}
export {};
