import * as ZB from '../lib/interfaces';
import { KeyedObject } from '../lib/interfaces';
import { ZBWorker } from './ZBWorker';
export declare class ZBClient {
    gatewayAddress: string;
    private closePromise?;
    private closing;
    private gRPCClient;
    private options;
    private workerCount;
    private workers;
    private retry;
    private maxRetries;
    private maxRetryTimeout;
    constructor(gatewayAddress: string, options?: ZB.ZBClientOptions);
    /**
     *
     * @param id - A unique identifier for this worker.
     * @param taskType - The BPMN Zeebe task type that this worker services.
     * @param taskHandler - A handler for activated jobs.
     * @param options - Configuration options for the worker.
     */
    createWorker<WorkerInputVariables = KeyedObject, CustomHeaderShape = KeyedObject, WorkerOutputVariables = WorkerInputVariables>(id: string, taskType: string, taskHandler: ZB.ZBWorkerTaskHandler<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>, options?: ZB.ZBWorkerOptions & ZB.ZBClientOptions, onConnectionError?: ZB.ConnectionErrorHandler | undefined): ZBWorker<WorkerInputVariables, CustomHeaderShape, WorkerOutputVariables>;
    /**
     * Gracefully shut down all workers, draining existing tasks, and return when it is safe to exit.
     * @returns Promise
     * @memberof ZBClient
     */
    close(): Promise<any>;
    /**
     * Return the broker cluster topology
     */
    topology(): Promise<ZB.TopologyResponse>;
    /**
     *
     * @param workflow - A path or array of paths to .bpmn files.
     * @param {redeploy?: boolean} - Redeploy workflow. Defaults to true.
     * If set false, will not redeploy a workflow that exists.
     */
    deployWorkflow(workflow: string | string[]): Promise<ZB.DeployWorkflowResponse>;
    /**
     * Return an array of task-types specified in a BPMN file.
     * @param file - Path to bpmn file.
     */
    getServiceTypesFromBpmn(files: string | string[]): Promise<string[]>;
    /**
     * Publish a message to the broker for correlation with a workflow instance.
     * @param publishMessageRequest - The message to publish.
     */
    publishMessage<T = KeyedObject>(publishMessageRequest: ZB.PublishMessageRequest<T>): Promise<void>;
    /**
     * Publish a message to the broker for correlation with a workflow message start event.
     * @param publishStartMessageRequest - The message to publish.
     */
    publishStartMessage<T = KeyedObject>(publishStartMessageRequest: ZB.PublishStartMessageRequest<T>): Promise<void>;
    updateJobRetries(updateJobRetriesRequest: ZB.UpdateJobRetriesRequest): Promise<void>;
    failJob(failJobRequest: ZB.FailJobRequest): Promise<void>;
    /**
     *
     * Create and start execution of a workflow instance.
     * @param {string} bpmnProcessId
     * @param {Variables} variables - payload to pass in to the workflow
     * @param {number} [version] - version of the workflow to run. Optional: defaults to latest if not present
     * @returns {Promise<CreateWorkflowInstanceResponse>}
     * @memberof ZBClient
     */
    createWorkflowInstance<Variables = KeyedObject>(bpmnProcessId: string, variables: Variables, version?: number): Promise<ZB.CreateWorkflowInstanceResponse>;
    cancelWorkflowInstance(workflowInstanceKey: string | number): Promise<void>;
    setVariables<Variables = KeyedObject>(request: ZB.SetVariablesRequest<Variables>): Promise<void>;
    resolveIncident(incidentKey: string): Promise<void>;
    /**
     * If this.retry is set true, the operation will be wrapped in an configurable retry on exceptions
     * of gRPC error code 14 - Transient Network Failure.
     * See: https://github.com/grpc/grpc/blob/master/doc/statuscodes.md
     * If this.retry is false, it will be executed with no retry, and the application should handle the exception.
     * @param operation A gRPC command operation
     */
    private executeOperation;
    /**
     * This function takes a gRPC operation that returns a Promise as a function, and invokes it.
     * If the operation throws gRPC error 14, this function will continue to try it until it succeeds
     * or retries are exhausted.
     * @param operation A gRPC command operation that may fail if the broker is not available
     */
    private retryOnFailure;
}
