@nam088/nestjs-rabbitmq
Version:
A comprehensive RabbitMQ module for NestJS with decorator-based message handling
34 lines (33 loc) • 1.73 kB
TypeScript
import { OnModuleDestroy } from '@nestjs/common';
import { AmqpConnectionManager, ChannelWrapper } from 'amqp-connection-manager';
import { Options } from 'amqplib';
import { PublishOptions, RpcOptions } from '../interfaces/rabbitmq-options.interface';
export declare class RabbitMQService implements OnModuleDestroy {
private readonly connectionManager;
private readonly connectionName;
private channel;
private readonly logger;
private readonly logLevel;
private readonly rpcQueues;
constructor(connectionManager: AmqpConnectionManager, connectionName: string, logLevel?: 'debug' | 'error' | 'log' | 'none' | 'warn');
onModuleDestroy(): Promise<void>;
getChannel(): ChannelWrapper;
getConnectionManager(): AmqpConnectionManager;
private getReplyQueue;
publish(exchange: string, routingKey: string, message: any, options?: PublishOptions): Promise<boolean>;
private deserializeMessage;
private serializeMessage;
assertExchange(exchange: string, type: 'direct' | 'fanout' | 'headers' | 'topic', options?: Options.AssertExchange): Promise<void>;
assertQueue(queue: string, options?: Options.AssertQueue): Promise<void>;
bindQueue(queue: string, exchange: string, routingKey: string): Promise<void>;
close(): Promise<void>;
consume(queue: string, onMessage: (msg: any) => Promise<void> | void, options?: Options.Consume): Promise<void>;
initialize(): Promise<void>;
isConnected(): boolean;
request<T = any>(queue: string, message: any, options?: RpcOptions): Promise<T>;
sendToQueue(queue: string, message: any, options?: Options.Publish): Promise<boolean>;
private debug;
private info;
private shouldLog;
private warn;
}