import { Connection, Channel } from "amqplib"; export interface Task { queue: string; exchange: string; routeKey: string; type?: string; prefetch?: number; options?: { [x: string]: any; queue?: { [x: string]: any; }; }; action(payload: any, done: Done): any; } export interface RPC { queue: string; action(payload: any, done: DoneRPC): any; } interface Done { (nack?: any, requeue?: boolean, allUpTo?: boolean): void; } interface DoneRPC { (reply?: any): void; } interface BrokerOptions { host?: string; } interface BrokerSend { (exchange: string, routeKey: string, message: string | { [x: string]: any; }, options?: any): void; } export default class Broker implements BrokerOptions { host?: string; ch: Channel; con: Connection; running: number; consumerTags: any[]; apm: any; constructor(options: BrokerOptions, Apm?: any); start(): Promise; send(exchange: string, routeKey: string, message: string | { [x: string]: any; }, options?: { [x: string]: any; skipAssert?: boolean; priority?: number; }): Promise; rpc(queue: string, message: any): Promise; bindRPC(rpc: RPC): Promise; bindTask(task: Task): Promise; stop(): Promise; } export { BrokerOptions, BrokerSend };