UNPKG

@rxap/nest-amqp

Version:
35 lines 2.11 kB
import { LoggerService } from '@nestjs/common'; import { CustomTransportStrategy, MessageHandler, ReadPacket, RmqContext, Server, WritePacket } from '@nestjs/microservices'; import type { AmqpConnectionManager } from 'amqp-connection-manager'; import { ChannelWrapper } from 'amqp-connection-manager'; import { Observable, Subscription } from 'rxjs'; import { ErrorSerializer } from './error.serializer'; import { ServerRmqOptions } from './options'; export declare const TRANSPORT_ID: unique symbol; export declare class ServerRMQ extends Server implements CustomTransportStrategy { protected readonly options: ServerRmqOptions; protected readonly logger: LoggerService; static instances: ServerRMQ[]; readonly transportId: symbol; server: AmqpConnectionManager | null; protected channel: ChannelWrapper | null; protected connectionAttempts: number; protected queue: string; protected errorSerializer: ErrorSerializer; constructor(options: ServerRmqOptions, logger?: LoggerService); listen(callback: (err?: unknown, ...optionalParams: unknown[]) => void): Promise<void>; close(): void; bindQueue(exchange: string, routingKey: string): Promise<void>; start(callback?: (err?: unknown, ...optionalParams: unknown[]) => void): Promise<void>; send(stream$: Observable<any>, respond: (data: WritePacket) => unknown | Promise<unknown>): Subscription; createClient(): AmqpConnectionManager; setupChannel(channel: ChannelWrapper, callback?: () => any): Promise<void>; handleMessage(message: Record<string, any>, channel: any): Promise<void>; handleEvent(pattern: string, packet: ReadPacket, context: RmqContext): Promise<any>; sendMessage<T = any>(message: T, replyTo: any, correlationId: string): void; addHandler(pattern: any, callback: MessageHandler, isEventHandler?: boolean, extras?: Record<any, any>): void; protected initializeDeserializer(options: ServerRmqOptions): void; protected initializeSerializer(options: ServerRmqOptions): void; private parseMessageContent; } //# sourceMappingURL=server-rmq.d.ts.map