/// <reference types="node" />
import { ILogger } from '../logger';
import { StreamService } from '../stream';
import { RouterConfig, StreamData, StreamDataResponse, StreamRole } from '../../types/stream';
import { ProviderClient, ProviderTransaction } from '../../types/provider';
declare class Router<S extends StreamService<ProviderClient, ProviderTransaction>> {
    static instances: Set<Router<any>>;
    appId: string;
    guid: string;
    hasReachedMaxBackoff: boolean | undefined;
    role: StreamRole;
    topic: string | undefined;
    stream: S;
    reclaimDelay: number;
    reclaimCount: number;
    logger: ILogger;
    throttle: number;
    errorCount: number;
    counts: {
        [key: string]: number;
    };
    currentTimerId: NodeJS.Timeout | null;
    shouldConsume: boolean;
    sleepPromiseResolve: (() => void) | null;
    innerPromiseResolve: (() => void) | null;
    isSleeping: boolean;
    sleepTimout: NodeJS.Timeout | null;
    readonly: boolean;
    constructor(config: RouterConfig, stream: S, logger: ILogger);
    private resetThrottleState;
    createGroup(stream: string, group: string): Promise<void>;
    publishMessage(topic: string, streamData: StreamData | StreamDataResponse, transaction?: ProviderTransaction): Promise<string | ProviderTransaction>;
    /**
     * An adjustable throttle that will interrupt a sleeping
     * router if the throttle is reduced and the sleep time
     * has elapsed. If the throttle is increased, or if
     * the sleep time has not elapsed, the router will continue
     * to sleep until the new termination point. This
     * allows for dynamic, elastic throttling with smooth
     * acceleration and deceleration.
     */
    customSleep(): Promise<void>;
    consumeMessages(stream: string, group: string, consumer: string, callback: (streamData: StreamData) => Promise<StreamDataResponse | void>): Promise<void>;
    isStreamMessage(result: any): boolean;
    isPaused(): boolean;
    isStopped(group: string, consumer: string, stream: string): boolean;
    consumeOne(stream: string, group: string, id: string, input: StreamData, callback: (streamData: StreamData) => Promise<StreamDataResponse | void>): Promise<void>;
    execStreamLeg(input: StreamData, stream: string, id: string, callback: (streamData: StreamData) => Promise<StreamDataResponse | void>): Promise<StreamData>;
    ackAndDelete(stream: string, group: string, id: string): Promise<void>;
    publishResponse(input: StreamData, output: StreamDataResponse | void): Promise<string>;
    shouldRetry(input: StreamData, output: StreamDataResponse): [boolean, number];
    structureUnhandledError(input: StreamData, err: Error): StreamDataResponse;
    structureUnacknowledgedError(input: StreamData): StreamData;
    structureError(input: StreamData, output: StreamDataResponse): StreamDataResponse;
    static stopConsuming(): Promise<void>;
    stopConsuming(): Promise<void>;
    cancelThrottle(): void;
    setThrottle(delayInMillis: number): void;
}
export { Router };
