@nam088/nestjs-rabbitmq
Version:
A comprehensive RabbitMQ module for NestJS with decorator-based message handling
43 lines (42 loc) • 1.64 kB
TypeScript
import { OnModuleDestroy, OnModuleInit } from '@nestjs/common';
import { ServiceDiscoveryOptions, ServiceFilterOptions, ServiceInfo } from '../interfaces/service-discovery.interface';
import { RabbitMQService } from './rabbitmq.service';
export declare class ServiceDiscoveryService implements OnModuleDestroy, OnModuleInit {
private readonly rabbitMQService;
private readonly options;
private cleanupInterval?;
private heartbeatInterval?;
private isRegistered;
private readonly logger;
private readonly logLevel;
private readonly services;
private serviceId;
constructor(rabbitMQService: RabbitMQService, options: ServiceDiscoveryOptions);
onModuleDestroy(): Promise<void>;
onModuleInit(): Promise<void>;
getAllServices(): ServiceInfo[];
private getCurrentServiceInfo;
private getExchangeName;
getHealthyServices(serviceName?: string): ServiceInfo[];
getRandomHealthyService(serviceName: string): ServiceInfo | undefined;
private getRoutingKey;
getServiceById(serviceId: string): ServiceInfo | undefined;
getServiceCount(serviceName?: string): number;
getServices(filter?: ServiceFilterOptions): ServiceInfo[];
private setupDiscovery;
private publishServiceEvent;
hasService(serviceName: string): boolean;
private cleanupDeadServices;
private debug;
private deregisterService;
private handleServiceEvent;
private info;
private registerService;
private sendHeartbeat;
private shouldLog;
private startCleanup;
private startHeartbeat;
private stopCleanup;
private stopHeartbeat;
private warn;
}