UNPKG

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