diff --git a/packages/microservices/client/client-rmq.ts b/packages/microservices/client/client-rmq.ts index de7a5c03f82..7cf210d088a 100644 --- a/packages/microservices/client/client-rmq.ts +++ b/packages/microservices/client/client-rmq.ts @@ -17,6 +17,7 @@ import { } from '../constants'; import { ReadPacket, RmqOptions, WritePacket } from '../interfaces'; import { ClientProxy } from './client-proxy'; +import { RmqUrl } from '../external/rmq-url.interface'; let rqmPackage: any = {}; @@ -27,7 +28,7 @@ export class ClientRMQ extends ClientProxy { protected connection: Promise; protected client: any = null; protected channel: any = null; - protected urls: string[]; + protected urls: string[] | RmqUrl[]; protected queue: string; protected queueOptions: any; protected responseEmitter: EventEmitter; diff --git a/packages/microservices/external/rmq-url.interface.ts b/packages/microservices/external/rmq-url.interface.ts new file mode 100644 index 00000000000..752b4601308 --- /dev/null +++ b/packages/microservices/external/rmq-url.interface.ts @@ -0,0 +1,11 @@ +export interface RmqUrl { + protocol?: string; + hostname?: string; + port?: number; + username?: string; + password?: string; + locale?: string; + frameMax?: number; + heartbeat?: number; + vhost?: string; +} diff --git a/packages/microservices/interfaces/microservice-configuration.interface.ts b/packages/microservices/interfaces/microservice-configuration.interface.ts index 147215bf819..fca8eedb7b5 100644 --- a/packages/microservices/interfaces/microservice-configuration.interface.ts +++ b/packages/microservices/interfaces/microservice-configuration.interface.ts @@ -12,6 +12,7 @@ import { Server } from '../server/server'; import { CustomTransportStrategy } from './custom-transport-strategy.interface'; import { Deserializer } from './deserializer.interface'; import { Serializer } from './serializer.interface'; +import { RmqUrl } from '../external/rmq-url.interface'; export type MicroserviceOptions = | GrpcOptions @@ -119,7 +120,7 @@ export interface NatsOptions { export interface RmqOptions { transport?: Transport.RMQ; options?: { - urls?: string[]; + urls?: string[] | RmqUrl[]; queue?: string; prefetchCount?: number; isGlobalPrefetchCount?: boolean; diff --git a/packages/microservices/server/server-rmq.ts b/packages/microservices/server/server-rmq.ts index 0546adab388..858d92f89e1 100644 --- a/packages/microservices/server/server-rmq.ts +++ b/packages/microservices/server/server-rmq.ts @@ -20,6 +20,7 @@ import { OutgoingResponse, } from '../interfaces/packet.interface'; import { Server } from './server'; +import { RmqUrl } from '../external/rmq-url.interface'; let rqmPackage: any = {}; @@ -28,7 +29,7 @@ export class ServerRMQ extends Server implements CustomTransportStrategy { protected server: any = null; protected channel: any = null; - protected readonly urls: string[]; + protected readonly urls: string[] | RmqUrl[]; protected readonly queue: string; protected readonly prefetchCount: number; protected readonly queueOptions: any;