@nestjs/microservices
Advanced tools
Comparing version 5.3.15 to 5.4.0-0
@@ -9,2 +9,3 @@ "use strict"; | ||
const client_tcp_1 = require("./client-tcp"); | ||
const client_rmq_1 = require("./client-rmq"); | ||
class ClientProxyFactory { | ||
@@ -22,2 +23,4 @@ static create(clientOptions) { | ||
return new client_grpc_1.ClientGrpcProxy(options); | ||
case transport_enum_1.Transport.RMQ: | ||
return new client_rmq_1.ClientRMQ(options); | ||
default: | ||
@@ -24,0 +27,0 @@ return new client_tcp_1.ClientTCP(options); |
@@ -7,3 +7,5 @@ export declare const TCP_DEFAULT_PORT = 3000; | ||
export declare const GRPC_DEFAULT_URL = "localhost:5000"; | ||
export declare const RQM_DEFAULT_URL = "amqp://localhost"; | ||
export declare const CONNECT_EVENT = "connect"; | ||
export declare const DISCONNECT_EVENT = "disconnect"; | ||
export declare const MESSAGE_EVENT = "message"; | ||
@@ -19,1 +21,6 @@ export declare const ERROR_EVENT = "error"; | ||
export declare const NO_PATTERN_MESSAGE = "There is no equivalent message pattern defined in the remote service."; | ||
export declare const DISCONNECTED_RMQ_MESSAGE = "Disconnected from RMQ. Trying to reconnect."; | ||
export declare const RQM_DEFAULT_QUEUE = "default"; | ||
export declare const RQM_DEFAULT_PREFETCH_COUNT = 0; | ||
export declare const RQM_DEFAULT_IS_GLOBAL_PREFETCH_COUNT: boolean; | ||
export declare const RQM_DEFAULT_QUEUE_OPTIONS: {}; |
@@ -9,3 +9,5 @@ "use strict"; | ||
exports.GRPC_DEFAULT_URL = 'localhost:5000'; | ||
exports.RQM_DEFAULT_URL = 'amqp://localhost'; | ||
exports.CONNECT_EVENT = 'connect'; | ||
exports.DISCONNECT_EVENT = 'disconnect'; | ||
exports.MESSAGE_EVENT = 'message'; | ||
@@ -21,1 +23,6 @@ exports.ERROR_EVENT = 'error'; | ||
exports.NO_PATTERN_MESSAGE = `There is no equivalent message pattern defined in the remote service.`; | ||
exports.DISCONNECTED_RMQ_MESSAGE = `Disconnected from RMQ. Trying to reconnect.`; | ||
exports.RQM_DEFAULT_QUEUE = 'default'; | ||
exports.RQM_DEFAULT_PREFETCH_COUNT = 0; | ||
exports.RQM_DEFAULT_IS_GLOBAL_PREFETCH_COUNT = false; | ||
exports.RQM_DEFAULT_QUEUE_OPTIONS = {}; |
@@ -7,2 +7,3 @@ export declare enum Transport { | ||
GRPC = 4, | ||
RMQ = 5, | ||
} |
@@ -10,2 +10,3 @@ "use strict"; | ||
Transport[Transport["GRPC"] = 4] = "GRPC"; | ||
Transport[Transport["RMQ"] = 5] = "RMQ"; | ||
})(Transport = exports.Transport || (exports.Transport = {})); |
@@ -1,4 +0,4 @@ | ||
import { Transport } from '../enums/transport.enum'; | ||
import { GrpcOptions, MqttOptions, NatsOptions, RedisOptions } from './microservice-configuration.interface'; | ||
export declare type ClientOptions = RedisOptions | NatsOptions | MqttOptions | GrpcOptions | TcpClientOptions; | ||
import { Transport } from './../enums/transport.enum'; | ||
import { RedisOptions, NatsOptions, MqttOptions, GrpcOptions, RmqOptions } from './microservice-configuration.interface'; | ||
export declare type ClientOptions = RedisOptions | NatsOptions | MqttOptions | GrpcOptions | TcpClientOptions | RmqOptions; | ||
export interface TcpClientOptions { | ||
@@ -5,0 +5,0 @@ transport: Transport.TCP; |
import { MqttClientOptions } from '@nestjs/common/interfaces/external/mqtt-options.interface'; | ||
import { Transport } from '../enums/transport.enum'; | ||
import { Server } from '../server/server'; | ||
import { Server } from './../server/server'; | ||
import { CustomTransportStrategy } from './custom-transport-strategy.interface'; | ||
export declare type MicroserviceOptions = GrpcOptions | TcpOptions | RedisOptions | NatsOptions | MqttOptions | CustomStrategy; | ||
export declare type MicroserviceOptions = GrpcOptions | TcpOptions | RedisOptions | NatsOptions | MqttOptions | RmqOptions | CustomStrategy; | ||
export interface CustomStrategy { | ||
@@ -66,4 +66,17 @@ strategy: Server & CustomTransportStrategy; | ||
servers?: string[]; | ||
reconnect?: boolean; | ||
pedantic?: boolean; | ||
tls?: any; | ||
queue?: string; | ||
}; | ||
} | ||
export interface RmqOptions { | ||
transport?: Transport.RMQ; | ||
options?: { | ||
urls?: string[]; | ||
queue?: string; | ||
prefetchCount?: number; | ||
isGlobalPrefetchCount?: boolean; | ||
queueOptions?: any; | ||
}; | ||
} |
{ | ||
"name": "@nestjs/microservices", | ||
"version": "5.3.15", | ||
"version": "5.4.0-0", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@microservices)", | ||
@@ -5,0 +5,0 @@ "author": "Kamil Mysliwiec", |
@@ -9,2 +9,3 @@ "use strict"; | ||
const server_tcp_1 = require("./server-tcp"); | ||
const server_rmq_1 = require("./server-rmq"); | ||
class ServerFactory { | ||
@@ -22,2 +23,4 @@ static create(microserviceOptions) { | ||
return new server_grpc_1.ServerGrpc(options); | ||
case transport_enum_1.Transport.RMQ: | ||
return new server_rmq_1.ServerRMQ(options); | ||
default: | ||
@@ -24,0 +27,0 @@ return new server_tcp_1.ServerTCP(options); |
@@ -24,6 +24,11 @@ "use strict"; | ||
bindEvents(client) { | ||
const queue = this.getOptionsProp(this.options, 'queue'); | ||
const subscribe = (channel) => { | ||
if (queue) { | ||
return client.subscribe(channel, { queue }, this.getMessageHandler(channel, client).bind(this)); | ||
} | ||
client.subscribe(channel, this.getMessageHandler(channel, client).bind(this)); | ||
}; | ||
const registeredPatterns = Object.keys(this.messageHandlers); | ||
registeredPatterns.forEach(channel => { | ||
client.subscribe(channel, this.getMessageHandler(channel, client).bind(this)); | ||
}); | ||
registeredPatterns.forEach(channel => subscribe(channel)); | ||
} | ||
@@ -30,0 +35,0 @@ close() { |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
139121
115
3153
2