/**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { Metadata } from '@grpc/grpc-js';
import { Settings as SettingsPB, Status, ClientType } from '../../proto/apache/rocketmq/v2/definition_pb';
import { RecoverOrphanedTransactionCommand, VerifyMessageCommand, PrintThreadStackTraceCommand, ReconnectEndpointsCommand, TelemetryCommand, HeartbeatRequest, NotifyClientTerminationRequest } from '../../proto/apache/rocketmq/v2/service_pb';
import { TopicRouteData, Endpoints } from '../route';
import { Settings } from './Settings';
import { ILogger } from './Logger';
import { SessionCredentials } from './SessionCredentials';
import { RpcClientManager } from './RpcClientManager';
import { TelemetrySession } from './TelemetrySession';
export interface BaseClientOptions {
    sslEnabled?: boolean;
    /**
     * rocketmq cluster endpoints, e.g.:
     * - 127.0.0.1:8081;127.0.0.1:8082
     * - 127.0.0.1:8081
     * - example.com
     * - example.com:8443
     */
    endpoints: string;
    namespace: string;
    sessionCredentials?: SessionCredentials;
    requestTimeout?: number;
    logger?: ILogger;
    topics?: string[];
}
/**
 * RocketMQ Base Client, Consumer and Producer should extends this class
 *
 * it handle:
 *  - RpcClient lifecycle, e.g: cleanup the idle clients
 *  - startup flow
 *  - periodic Task
 */
export declare abstract class BaseClient {
    #private;
    readonly clientId: string;
    readonly sslEnabled: boolean;
    readonly namespace: string;
    protected readonly endpoints: Endpoints;
    protected readonly isolated: Map<string, Endpoints>;
    protected readonly requestTimeout: number;
    protected readonly topics: Set<string>;
    protected readonly topicRouteCache: Map<string, TopicRouteData>;
    protected readonly inflightRouteFutures: Map<string, Promise<TopicRouteData>>;
    protected readonly logger: ILogger;
    protected readonly rpcClientManager: RpcClientManager;
    /**
     * Get the client type.
     * Subclasses should override this method to return their specific client type.
     *
     * @return The client type identifier
     */
    protected getClientType(): ClientType;
    constructor(options: BaseClientOptions);
    /**
     * Startup flow
     * https://github.com/apache/rocketmq-clients/blob/master/docs/workflow.md#startup
     */
    startup(): Promise<void>;
    isRunning(): boolean;
    protected sleep(ms: number): Promise<void>;
    shutdown(): Promise<void>;
    protected getTotalRouteEndpoints(): Endpoints[];
    protected findNewRouteEndpoints(endpointsList: Endpoints[]): Endpoints[];
    protected updateRoutes(): Promise<void>;
    protected getRouteData(topic: string): Promise<TopicRouteData>;
    settingsCommand(): TelemetryCommand;
    getTelemetrySession(endpoints: Endpoints): TelemetrySession;
    createTelemetryStream(endpoints: Endpoints): import("@grpc/grpc-js").ClientDuplexStream<TelemetryCommand, TelemetryCommand>;
    telemetry(endpoints: Endpoints, command: TelemetryCommand): void;
    getRequestMetadata(): Metadata;
    protected abstract getSettings(): Settings;
    /**
     * Wrap heartbeat request
     */
    protected abstract wrapHeartbeatRequest(): HeartbeatRequest;
    /**
     * Wrap notify client termination request.
     */
    protected abstract wrapNotifyClientTerminationRequest(): NotifyClientTerminationRequest;
    protected onTopicRouteDataUpdate(_topic: string, _topicRouteData: TopicRouteData): void;
    onUnknownCommand(endpoints: Endpoints, status: Status.AsObject): void;
    onSettingsCommand(_endpoints: Endpoints, settings: SettingsPB): void;
    onRecoverOrphanedTransactionCommand(_endpoints: Endpoints, command: RecoverOrphanedTransactionCommand): void;
    onVerifyMessageCommand(endpoints: Endpoints, command: VerifyMessageCommand): void;
    onPrintThreadStackTraceCommand(endpoints: Endpoints, command: PrintThreadStackTraceCommand): void;
    onReconnectEndpointsCommand(endpoints: Endpoints, _command: ReconnectEndpointsCommand): void;
    /**
     * Get the endpoints of this client.
     *
     * @return The endpoints
     */
    getEndpoints(): Endpoints;
    /**
     * Get the RPC client manager.
     *
     * @return The RPC client manager
     */
    getRpcClientManager(): RpcClientManager;
}
