import { Action, BaseRouteDefinition } from '../server/types';
import { IBroker, RequestMapper, RouteMapper } from './IBroker';
import { IConfiguration, BrokerConnectionErrorHandler } from '../server';
export declare type ActionHandler = (action: Action) => Action | Promise<Action>;
export declare type DefinitionHandlerPair = {
    def: BaseRouteDefinition;
    handler: ActionHandler;
};
export declare type ActionToRouteMapper = (route: string, action: Action, pairs: DefinitionHandlerPair[]) => ActionHandler;
export declare type ConfigResolver<T> = (config: IConfiguration) => T;
export declare abstract class AbstractBroker<TConfig> implements IBroker {
    private timeout;
    abstract name: string;
    private connectionErrorHandler?;
    /**
     * Configuration getter
     */
    appConfiguration?: IConfiguration;
    /**
     * Absolute configuration
     */
    absoluteConfig?: TConfig;
    /**
     * If provided absolute config, the construct method is called immediately
     * @param absoluteConfig
     */
    constructor(absoluteConfig?: TConfig);
    protected abstract construct(): void;
    get config(): TConfig;
    protected registeredRoutes: Map<string, DefinitionHandlerPair[]>;
    protected abstract routeMapper: RouteMapper;
    protected abstract requestMapper: RequestMapper;
    private configResolver;
    protected actionToRouteMapper: ActionToRouteMapper;
    setConfigResolver(cfg: IConfiguration, resolver: ConfigResolver<TConfig>): void;
    setAbsoluteConfig(config: TConfig): void;
    setConnectionErrorHandler(handler: BrokerConnectionErrorHandler): void;
    setRequestMapper(requestMapper: RequestMapper): void;
    setRouteMapper(routeMapper: RouteMapper): void;
    setActionToHandlerMapper(mapper: ActionToRouteMapper): void;
    getHandler(route: string, action: Action): ActionHandler;
    addRoute(def: BaseRouteDefinition, handler: ActionHandler): string;
    protected extractParamNames(path: string, separator?: string): {
        name: string;
        param: boolean;
    }[];
    getDefaultTimeout(): number;
    setDefaultTimeout(val: number): void;
    abstract start(): Promise<void>;
    protected handleConnectionError(e: any): void;
}
