UNPKG

2.23 kBTypeScriptView Raw
1/// <reference types="node" />
2/// <reference types="node" />
3import { Logger } from '@nestjs/common/services/logger.service';
4import { EventEmitter } from 'events';
5import { Observable, ReplaySubject } from 'rxjs';
6import { RmqUrl } from '../external/rmq-url.interface';
7import { ReadPacket, RmqOptions, WritePacket } from '../interfaces';
8import { ClientProxy } from './client-proxy';
9type Channel = any;
10type ChannelWrapper = any;
11type AmqpConnectionManager = any;
12/**
13 * @publicApi
14 */
15export declare class ClientRMQ extends ClientProxy {
16 protected readonly options: RmqOptions['options'];
17 protected readonly logger: Logger;
18 protected connection$: ReplaySubject<any>;
19 protected connection: Promise<any>;
20 protected client: AmqpConnectionManager;
21 protected channel: ChannelWrapper;
22 protected urls: string[] | RmqUrl[];
23 protected queue: string;
24 protected queueOptions: Record<string, any>;
25 protected responseEmitter: EventEmitter;
26 protected replyQueue: string;
27 protected persistent: boolean;
28 protected noAssert: boolean;
29 constructor(options: RmqOptions['options']);
30 close(): void;
31 connect(): Promise<any>;
32 createChannel(): Promise<void>;
33 createClient(): AmqpConnectionManager;
34 mergeDisconnectEvent<T = any>(instance: any, source$: Observable<T>): Observable<T>;
35 convertConnectionToPromise(): Promise<any>;
36 setupChannel(channel: Channel, resolve: Function): Promise<void>;
37 consumeChannel(channel: Channel): Promise<void>;
38 handleError(client: AmqpConnectionManager): void;
39 handleDisconnectError(client: AmqpConnectionManager): void;
40 handleMessage(packet: unknown, callback: (packet: WritePacket) => any): any;
41 handleMessage(packet: unknown, options: Record<string, unknown>, callback: (packet: WritePacket) => any): any;
42 protected publish(message: ReadPacket, callback: (packet: WritePacket) => any): () => void;
43 protected dispatchEvent(packet: ReadPacket): Promise<any>;
44 protected initializeSerializer(options: RmqOptions['options']): void;
45 protected mergeHeaders(requestHeaders?: Record<string, string>): Record<string, string> | undefined;
46 protected parseMessageContent(content: Buffer): any;
47}
48export {};