// Type definitions for amqplib 0.8 // Project: https://github.com/squaremo/amqp.node, http://squaremo.github.io/amqp.node // Definitions by: Michael Nahkies , // Ab Reitsma , // Nicolás Fantone , // Nick Zelei , // Vincenzo Chianese // Seonggwon Yoon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.2 /// import * as Promise from 'bluebird'; import * as events from 'events'; import { Replies, Options, Message, GetMessage, ConsumeMessage, ServerProperties } from './properties'; export * from './properties'; export interface Connection extends events.EventEmitter { close(): Promise; createChannel(): Promise; createConfirmChannel(): Promise; connection: { serverProperties: ServerProperties; }; } export interface Channel extends events.EventEmitter { close(): Promise; assertQueue(queue: string, options?: Options.AssertQueue): Promise; checkQueue(queue: string): Promise; deleteQueue(queue: string, options?: Options.DeleteQueue): Promise; purgeQueue(queue: string): Promise; bindQueue(queue: string, source: string, pattern: string, args?: any): Promise; unbindQueue(queue: string, source: string, pattern: string, args?: any): Promise; assertExchange(exchange: string, type: 'direct' | 'topic' | 'headers' | 'fanout' | 'match' | string, options?: Options.AssertExchange): Promise; checkExchange(exchange: string): Promise; deleteExchange(exchange: string, options?: Options.DeleteExchange): Promise; bindExchange(destination: string, source: string, pattern: string, args?: any): Promise; unbindExchange(destination: string, source: string, pattern: string, args?: any): Promise; publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean; sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean; consume(queue: string, onMessage: (msg: ConsumeMessage | null) => void, options?: Options.Consume): Promise; cancel(consumerTag: string): Promise; get(queue: string, options?: Options.Get): Promise; ack(message: Message, allUpTo?: boolean): void; ackAll(): void; nack(message: Message, allUpTo?: boolean, requeue?: boolean): void; nackAll(requeue?: boolean): void; reject(message: Message, requeue?: boolean): void; prefetch(count: number, global?: boolean): Promise; recover(): Promise; } export interface ConfirmChannel extends Channel { publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean; waitForConfirms(): Promise; } export const credentials: { amqplain(username: string, password: string): { mechanism: string; response(): Buffer; username: string; password: string; }; external(): { mechanism: string; response(): Buffer; }; plain(username: string, password: string): { mechanism: string; response(): Buffer; username: string; password: string; }; }; export function connect(url: string | Options.Connect, socketOptions?: any): Promise;