Skip to content

Commit

Permalink
Merge pull request #5609 from capaio/rmq-url-acceptable-types
Browse files Browse the repository at this point in the history
feature(microservices): update acceptable types in RabbitMq urls
  • Loading branch information
kamilmysliwiec authored Nov 2, 2020
2 parents 62352ac + 1655e96 commit 0ec42bd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/microservices/client/client-rmq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,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 = {};

Expand All @@ -28,7 +29,7 @@ export class ClientRMQ extends ClientProxy {
protected connection: Promise<any>;
protected client: any = null;
protected channel: any = null;
protected urls: string[];
protected urls: string[] | RmqUrl[];
protected queue: string;
protected queueOptions: any;
protected responseEmitter: EventEmitter;
Expand Down
11 changes: 11 additions & 0 deletions packages/microservices/external/rmq-url.interface.ts
Original file line number Diff line number Diff line change
@@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion packages/microservices/server/server-rmq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
OutgoingResponse,
} from '../interfaces/packet.interface';
import { Server } from './server';
import { RmqUrl } from '../external/rmq-url.interface';

let rqmPackage: any = {};

Expand All @@ -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;
Expand Down

0 comments on commit 0ec42bd

Please sign in to comment.