import { connect, Connection, Channel } from 'amqplib'; import { Logger } from '../log/LogManager'; import { ReadyGate } from '../util/ReadyGate'; import { RabbitmqClientConfig } from './RabbitmqConfig'; export interface PublishOptions { expiration?: string | number; userId?: string; CC?: string | string[]; mandatory?: boolean; persistent?: boolean; deliveryMode?: boolean | number; BCC?: string | string[]; contentType?: string; contentEncoding?: string; headers?: any; priority?: number; correlationId?: string; replyTo?: string; messageId?: string; timestamp?: number; type?: string; appId?: string; } export interface ConsumeOptions { consumerTag?: string; noLocal?: boolean; noAck?: boolean; exclusive?: boolean; priority?: number; arguments?: any; } export interface RepliesConsume { consumerTag: string; } export declare abstract class RabbitmqClient { protected channel: Channel; protected connection: Connection; protected logger: Logger; protected clientConfig: RabbitmqClientConfig; protected name: string; /** * Whether the connection should be closed. This is not a statud indicator that show whether the connection is closed. * It is a flag that indicates whether the client has been purposely closed by code, as opposed to being closed because of an error. */ protected closed: boolean; protected reconnecting: boolean; protected readyGate: ReadyGate; protected shutdownFunction: () => void; protected connectFunction: typeof connect; constructor(clientConfig: RabbitmqClientConfig, name: string); init(): Promise; /** * Connect to RabbitMQ broker */ protected connect(): Promise; private createConnection(); protected createChannel(): Promise; protected handleErrorOrClose(cause: string, err?: Error): void; protected closeAllAndScheduleReconnection(): Promise; backoffWait(tryNum: number): Promise; attemptReconnection(): Promise; close(): Promise; private closeChannel(); private closeConnection(); protected debugMsg(str: any): string; }