@nestjs/microservices
- Version 10.4.13
- Published
- 406 kB
- 2 dependencies
- MIT license
Install
npm i @nestjs/microservices
yarn add @nestjs/microservices
pnpm add @nestjs/microservices
Overview
Nest - modern, fast, powerful node.js web framework (@microservices)
Index
Variables
Functions
Classes
ClientKafka
- bindTopics()
- brokers
- client
- clientId
- close()
- commitOffsets()
- connect()
- consumer
- consumerAssignments
- createClient()
- createResponseCallback()
- dispatchBatchEvent()
- dispatchEvent()
- emitBatch()
- getConsumerAssignments()
- getReplyTopicPartition()
- getResponsePatternName()
- groupId
- initialized
- initializeDeserializer()
- initializeSerializer()
- logger
- options
- parser
- producer
- producerOnlyMode
- publish()
- responsePatterns
- setConsumerAssignments()
- subscribeToResponseOf()
ClientRMQ
- channel
- client
- close()
- connect()
- connection
- connection$
- consumeChannel()
- convertConnectionToPromise()
- createChannel()
- createClient()
- dispatchEvent()
- handleDisconnectError()
- handleError()
- handleMessage()
- initializeSerializer()
- logger
- mergeDisconnectEvent()
- mergeHeaders()
- noAssert
- options
- parseMessageContent()
- persistent
- publish()
- queue
- queueOptions
- replyQueue
- responseEmitter
- setupChannel()
- urls
ServerGrpc
- addHandler()
- bindEvents()
- close()
- createClient()
- createPattern()
- createRequestStreamMethod()
- createService()
- createServiceMethod()
- createStreamCallMethod()
- createStreamServiceMethod()
- createUnaryServiceMethod()
- deserialize()
- getMessageHandler()
- getServiceNames()
- listen()
- loadProto()
- lookupPackage()
- start()
- transportId
ServerKafka
- assignCorrelationIdHeader()
- assignErrorHeader()
- assignIsDisposedHeader()
- assignReplyPartition()
- bindEvents()
- brokers
- client
- clientId
- close()
- consumer
- createClient()
- getMessageHandler()
- getPublisher()
- groupId
- handleEvent()
- handleMessage()
- initializeDeserializer()
- initializeSerializer()
- listen()
- logger
- options
- parser
- producer
- sendMessage()
- start()
- transportId
Interfaces
Enums
KafkaHeaders
- ACKNOWLEDGMENT
- BATCH_CONVERTED_HEADERS
- CONSUMER
- CORRELATION_ID
- DELIVERY_ATTEMPT
- DLT_EXCEPTION_FQCN
- DLT_EXCEPTION_MESSAGE
- DLT_EXCEPTION_STACKTRACE
- DLT_ORIGINAL_OFFSET
- DLT_ORIGINAL_PARTITION
- DLT_ORIGINAL_TIMESTAMP
- DLT_ORIGINAL_TIMESTAMP_TYPE
- DLT_ORIGINAL_TOPIC
- GROUP_ID
- MESSAGE_KEY
- NATIVE_HEADERS
- NEST_ERR
- NEST_IS_DISPOSED
- OFFSET
- PARTITION_ID
- PREFIX
- RAW_DATA
- RECEIVED
- RECEIVED_MESSAGE_KEY
- RECEIVED_PARTITION_ID
- RECEIVED_TIMESTAMP
- RECEIVED_TOPIC
- RECORD_METADATA
- REPLY_PARTITION
- REPLY_TOPIC
- TIMESTAMP
- TIMESTAMP_TYPE
- TOPIC
Type Aliases
- ClientOptions
- ClientProvider
- ClientProviderOptions
- ClientsModuleAsyncOptions
- ClientsModuleOptions
- ConsumerDeserializer
- ConsumerSerializer
- IncomingEvent
- IncomingRequest
- IncomingResponse
- MicroserviceOptions
- MsFundamentalPattern
- MsPattern
- OutgoingEvent
- OutgoingRequest
- OutgoingResponse
- PatternMetadata
- ProducerDeserializer
- ProducerSerializer
Variables
variable CONTEXT
const CONTEXT: string;
variable EventPattern
const EventPattern: { <T = string>(metadata?: T): MethodDecorator; <T = string>(metadata?: T, transport?: Transport | symbol): MethodDecorator; <T = string>(metadata?: T, extras?: Record<string, any>): MethodDecorator; <T = string>( metadata?: T, transport?: Transport | symbol, extras?: Record<string, any> ): MethodDecorator;};
Subscribes to incoming events which fulfils chosen pattern.
variable GrpcService
const GrpcService: any;
Defines the GrpcService. The service can inject dependencies through constructor. Those dependencies have to belong to the same module.
variable MessagePattern
const MessagePattern: { <T = PatternMetadata>(metadata?: T): MethodDecorator; <T = PatternMetadata>( metadata?: T, transport?: Transport | symbol ): MethodDecorator; <T = PatternMetadata>( metadata?: T, extras?: Record<string, any> ): MethodDecorator; <T = PatternMetadata>( metadata?: T, transport?: Transport | symbol, extras?: Record<string, any> ): MethodDecorator;};
Subscribes to incoming messages which fulfils chosen pattern.
Functions
function Client
Client: (metadata?: ClientOptions) => PropertyDecorator;
Attaches the
ClientProxy
instance to the given propertyParameter metadata
optional client metadata
function createGrpcMethodMetadata
createGrpcMethodMetadata: ( target: object, key: string | symbol, service: string | undefined, method: string | undefined, streaming?: GrpcMethodStreamingType) => { service: string; rpc: string; streaming: GrpcMethodStreamingType };
function Ctx
Ctx: () => ParameterDecorator;
function getGrpcPackageDefinition
getGrpcPackageDefinition: ( options: GrpcOptions['options'], grpcProtoLoaderPackage: any) => any;
function GrpcMethod
GrpcMethod: { (service?: string): MethodDecorator; (service: string, method?: string): MethodDecorator;};
Registers gRPC method handler for specified service.
function GrpcStreamCall
GrpcStreamCall: { (service?: string): MethodDecorator; (service: string, method?: string): MethodDecorator;};
Registers gRPC call pass through handler for service and method
Parameter service
String parameter reflecting the name of service definition from proto file
Parameter service
String parameter reflecting the name of service definition from proto file
Parameter method
Optional string parameter reflecting the name of method inside of a service definition coming after rpc keyword
function GrpcStreamMethod
GrpcStreamMethod: { (service?: string): MethodDecorator; (service: string, method?: string): MethodDecorator;};
Registers gRPC call through RX handler for service and method
Parameter service
String parameter reflecting the name of service definition from proto file
Parameter service
String parameter reflecting the name of service definition from proto file
Parameter method
Optional string parameter reflecting the name of method inside of a service definition coming after rpc keyword
function KafkaLogger
KafkaLogger: ( logger: any) => ({ namespace, level, label, log,}: { namespace: any; level: any; label: any; log: any;}) => void;
function Payload
Payload: { (): ParameterDecorator; (...pipes: any[]): ParameterDecorator; (propertyKey?: string, ...pipes: any[]): ParameterDecorator;};
Microservice message pattern payload parameter decorator.
Microservice message pattern payload parameter decorator.
Example:
create(@Payload(new ValidationPipe()) createDto: CreateCatDto)Parameter pipes
one or more pipes - either instances or classes - to apply to the bound parameter.
Microservice message pattern payload parameter decorator. Extracts a property from the payload object. May also apply pipes to the bound parameter.
For example, extracting all params:
findMany(@Payload() ids: string[])For example, extracting a single param:
create(@Payload('data') createDto: { data: string })For example, extracting a single param with pipe:
create(@Payload('data', new ValidationPipe()) createDto: { data: string })Parameter propertyKey
name of single property to extract from the message payload
Parameter pipes
one or more pipes - either instances or classes - to apply to the bound parameter.
Classes
class BaseRpcContext
class BaseRpcContext<T = unknown[]> {}
constructor
constructor(args: {});
property args
protected readonly args: {};
method getArgByIndex
getArgByIndex: (index: number) => any;
Returns a particular argument by index.
Parameter index
index of argument to retrieve
method getArgs
getArgs: () => T;
Returns the array of arguments being passed to the handler.
class BaseRpcExceptionFilter
class BaseRpcExceptionFilter<T = any, R = any> implements RpcExceptionFilter<T> {}
method catch
catch: (exception: T, host: ArgumentsHost) => Observable<R>;
method handleUnknownError
handleUnknownError: (exception: T, status: string) => Observable<never>;
method isError
isError: (exception: any) => exception is Error;
class ClientGrpcProxy
class ClientGrpcProxy extends ClientProxy implements ClientGrpc {}
constructor
constructor(options: { url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutDataMs?: number; http2MaxPingStrikes?: number; }; channelOptions?: ChannelOptions; credentials?: any; protoPath?: string | string[]; package: string | string[]; protoLoader?: string; packageDefinition?: any; gracefulShutdown?: boolean; onLoadPackageDefinition?: (pkg: any, server: any) => void; loader?: { keepCase?: boolean; alternateCommentMode?: boolean; longs?: Function; enums?: Function; bytes?: Function; defaults?: boolean; arrays?: boolean; objects?: boolean; oneofs?: boolean; json?: boolean; includeDirs?: string[]; };});
property clients
protected readonly clients: Map<string, any>;
property grpcClients
protected grpcClients: any[];
property logger
protected readonly logger: Logger;
property options
protected readonly options: { url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutDataMs?: number; http2MaxPingStrikes?: number; }; channelOptions?: ChannelOptions; credentials?: any; protoPath?: string | string[]; package: string | string[]; protoLoader?: string; packageDefinition?: any; gracefulShutdown?: boolean; onLoadPackageDefinition?: (pkg: any, server: any) => void; loader?: { keepCase?: boolean; alternateCommentMode?: boolean; longs?: Function; enums?: Function; bytes?: Function; defaults?: boolean; arrays?: boolean; objects?: boolean; oneofs?: boolean; json?: boolean; includeDirs?: string[]; };};
property url
protected readonly url: string;
method close
close: () => void;
method connect
connect: () => Promise<any>;
method createClientByServiceName
createClientByServiceName: (name: string) => any;
method createClients
createClients: () => any[];
method createServiceMethod
createServiceMethod: ( client: any, methodName: string) => (...args: unknown[]) => Observable<unknown>;
method createStreamServiceMethod
createStreamServiceMethod: ( client: unknown, methodName: string) => (...args: any[]) => Observable<any>;
method createUnaryServiceMethod
createUnaryServiceMethod: ( client: any, methodName: string) => (...args: any[]) => Observable<any>;
method dispatchEvent
protected dispatchEvent: (packet: any) => Promise<any>;
method getClient
protected getClient: (name: string) => any;
method getClientByServiceName
getClientByServiceName: <T = unknown>(name: string) => T;
method getKeepaliveOptions
getKeepaliveOptions: () => {};
method getService
getService: <T extends {}>(name: string) => T;
method loadProto
loadProto: () => any;
method lookupPackage
lookupPackage: (root: any, packageName: string) => any;
method publish
protected publish: (packet: any, callback: (packet: any) => any) => any;
method send
send: <TResult = any, TInput = any>( pattern: any, data: TInput) => Observable<TResult>;
class ClientKafka
class ClientKafka extends ClientProxy {}
constructor
constructor(options: { postfixId?: string; client?: KafkaConfig; consumer?: ConsumerConfig; run?: Omit<ConsumerRunConfig, 'eachBatch' | 'eachMessage'>; subscribe?: Omit<ConsumerSubscribeTopics, 'topics'>; producer?: ProducerConfig; send?: Omit<ProducerRecord, 'topic' | 'messages'>; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; parser?: KafkaParserConfig; producerOnlyMode?: boolean;});
property brokers
protected brokers: string[] | BrokersFunction;
property client
protected client: Kafka;
property clientId
protected clientId: string;
property consumer
protected consumer: Consumer;
property consumerAssignments
protected consumerAssignments: { [key: string]: number };
property groupId
protected groupId: string;
property initialized
protected initialized: Promise<void>;
property logger
protected logger: Logger;
property options
protected readonly options: { postfixId?: string; client?: KafkaConfig; consumer?: ConsumerConfig; run?: Omit<ConsumerRunConfig, 'eachBatch' | 'eachMessage'>; subscribe?: Omit<ConsumerSubscribeTopics, 'topics'>; producer?: ProducerConfig; send?: Omit<ProducerRecord, 'topic' | 'messages'>; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; parser?: KafkaParserConfig; producerOnlyMode?: boolean;};
property parser
protected parser: KafkaParser;
property producer
protected producer: Producer;
property producerOnlyMode
protected producerOnlyMode: boolean;
property responsePatterns
protected responsePatterns: string[];
method bindTopics
bindTopics: () => Promise<void>;
method close
close: () => Promise<void>;
method commitOffsets
commitOffsets: ( topicPartitions: TopicPartitionOffsetAndMetadata[]) => Promise<void>;
method connect
connect: () => Promise<Producer>;
method createClient
createClient: <T = any>() => T;
method createResponseCallback
createResponseCallback: () => (payload: EachMessagePayload) => any;
method dispatchBatchEvent
protected dispatchBatchEvent: <TInput = any>( packets: ReadPacket<{ messages: TInput[] }>) => Promise<any>;
method dispatchEvent
protected dispatchEvent: (packet: OutgoingEvent) => Promise<any>;
method emitBatch
emitBatch: <TResult = any, TInput = any>( pattern: any, data: { messages: TInput[] }) => Observable<TResult>;
method getConsumerAssignments
getConsumerAssignments: () => { [key: string]: number };
method getReplyTopicPartition
protected getReplyTopicPartition: (topic: string) => string;
method getResponsePatternName
protected getResponsePatternName: (pattern: string) => string;
method initializeDeserializer
protected initializeDeserializer: (options: KafkaOptions['options']) => void;
method initializeSerializer
protected initializeSerializer: (options: KafkaOptions['options']) => void;
method publish
protected publish: ( partialPacket: ReadPacket, callback: (packet: WritePacket) => any) => () => void;
method setConsumerAssignments
protected setConsumerAssignments: (data: ConsumerGroupJoinEvent) => void;
method subscribeToResponseOf
subscribeToResponseOf: (pattern: any) => void;
class ClientMqtt
class ClientMqtt extends ClientProxy {}
constructor
constructor( options: MqttClientOptions & { url?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; subscribeOptions?: { qos: QoS; nl?: boolean; rap?: boolean; rh?: number; }; userProperties?: Record<string, string | string[]>; });
property connection
protected connection: Promise<any>;
property logger
protected readonly logger: Logger;
property mqttClient
protected mqttClient: MqttClient;
property options
protected readonly options: MqttClientOptions & { url?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; subscribeOptions?: { qos: QoS; nl?: boolean; rap?: boolean; rh?: number }; userProperties?: Record<string, string | string[]>;};
property subscriptionsCount
protected readonly subscriptionsCount: Map<string, number>;
property url
protected readonly url: string;
method close
close: () => void;
method connect
connect: () => Promise<any>;
method createClient
createClient: () => MqttClient;
method createResponseCallback
createResponseCallback: () => (channel: string, buffer: Buffer) => any;
method dispatchEvent
protected dispatchEvent: (packet: ReadPacket) => Promise<any>;
method getRequestPattern
getRequestPattern: (pattern: string) => string;
method getResponsePattern
getResponsePattern: (pattern: string) => string;
method handleError
handleError: (client: MqttClient) => void;
method initializeSerializer
protected initializeSerializer: (options: MqttOptions['options']) => void;
method mergeCloseEvent
mergeCloseEvent: <T = any>( instance: MqttClient, source$: Observable<T>) => Observable<T>;
method mergePacketOptions
protected mergePacketOptions: ( requestOptions?: MqttRecordOptions) => MqttRecordOptions | undefined;
method publish
protected publish: ( partialPacket: ReadPacket, callback: (packet: WritePacket) => any) => () => void;
method unsubscribeFromChannel
protected unsubscribeFromChannel: (channel: string) => void;
class ClientNats
class ClientNats extends ClientProxy {}
constructor
constructor(options: { [key: string]: any; headers?: Record<string, string>; authenticator?: any; debug?: boolean; ignoreClusterUpdates?: boolean; inboxPrefix?: string; encoding?: string; name?: string; user?: string; pass?: string; maxPingOut?: number; maxReconnectAttempts?: number; reconnectTimeWait?: number; reconnectJitter?: number; reconnectJitterTLS?: number; reconnectDelayHandler?: any; servers?: string | string[]; nkey?: any; reconnect?: boolean; pedantic?: boolean; tls?: any; queue?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; userJWT?: string; nonceSigner?: any; userCreds?: any; useOldRequestStyle?: boolean; pingInterval?: number; preserveBuffers?: boolean; waitOnFirstConnect?: boolean; verbose?: boolean; noEcho?: boolean; noRandomize?: boolean; timeout?: number; token?: string; yieldTime?: number; tokenHandler?: any;});
property clientConnectionPromise
protected clientConnectionPromise: Promise<Client>;
property logger
protected readonly logger: Logger;
property natsClient
protected natsClient: Client;
property options
protected readonly options: { [key: string]: any; headers?: Record<string, string>; authenticator?: any; debug?: boolean; ignoreClusterUpdates?: boolean; inboxPrefix?: string; encoding?: string; name?: string; user?: string; pass?: string; maxPingOut?: number; maxReconnectAttempts?: number; reconnectTimeWait?: number; reconnectJitter?: number; reconnectJitterTLS?: number; reconnectDelayHandler?: any; servers?: string | string[]; nkey?: any; reconnect?: boolean; pedantic?: boolean; tls?: any; queue?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; userJWT?: string; nonceSigner?: any; userCreds?: any; useOldRequestStyle?: boolean; pingInterval?: number; preserveBuffers?: boolean; waitOnFirstConnect?: boolean; verbose?: boolean; noEcho?: boolean; noRandomize?: boolean; timeout?: number; token?: string; yieldTime?: number; tokenHandler?: any;};
method close
close: () => Promise<void>;
method connect
connect: () => Promise<any>;
method createClient
createClient: () => Promise<Client>;
method createSubscriptionHandler
createSubscriptionHandler: ( packet: ReadPacket & PacketId, callback: (packet: WritePacket) => any) => (error: unknown | undefined, natsMsg: NatsMsg) => Promise<any>;
method dispatchEvent
protected dispatchEvent: (packet: ReadPacket) => Promise<any>;
method handleStatusUpdates
handleStatusUpdates: (client: Client) => Promise<void>;
method initializeDeserializer
protected initializeDeserializer: (options: NatsOptions['options']) => void;
method initializeSerializer
protected initializeSerializer: (options: NatsOptions['options']) => void;
method mergeHeaders
protected mergeHeaders: <THeaders = any>(requestHeaders?: THeaders) => any;
method publish
protected publish: ( partialPacket: ReadPacket, callback: (packet: WritePacket) => any) => () => void;
class ClientProxy
abstract class ClientProxy {}
property deserializer
protected deserializer: ProducerDeserializer;
property routingMap
protected routingMap: Map<string, Function>;
property serializer
protected serializer: ProducerSerializer;
method assignPacketId
protected assignPacketId: (packet: ReadPacket) => ReadPacket & PacketId;
method close
abstract close: () => any;
method connect
abstract connect: () => Promise<any>;
method connect$
protected connect$: ( instance: any, errorEvent?: string, connectEvent?: string) => Observable<any>;
method createObserver
protected createObserver: <T>( observer: Observer<T>) => (packet: WritePacket) => void;
method dispatchEvent
protected abstract dispatchEvent: <T = any>(packet: ReadPacket) => Promise<T>;
method emit
emit: <TResult = any, TInput = any>( pattern: any, data: TInput) => Observable<TResult>;
method getOptionsProp
protected getOptionsProp: < T extends | { url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutDataMs?: number; http2MaxPingStrikes?: number; }; channelOptions?: ChannelOptions; credentials?: any; protoPath?: string | string[]; package: string | string[]; protoLoader?: string; packageDefinition?: any; gracefulShutdown?: boolean; onLoadPackageDefinition?: (pkg: any, server: any) => void; loader?: { keepCase?: boolean; alternateCommentMode?: boolean; longs?: Function; enums?: Function; bytes?: Function; defaults?: boolean; arrays?: boolean; objects?: boolean; oneofs?: boolean; json?: boolean; includeDirs?: string[]; }; } | { postfixId?: string; client?: KafkaConfig; consumer?: ConsumerConfig; run?: Omit<ConsumerRunConfig, 'eachBatch' | 'eachMessage'>; subscribe?: Omit<ConsumerSubscribeTopics, 'topics'>; producer?: ProducerConfig; send?: Omit<ProducerRecord, 'topic' | 'messages'>; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; parser?: KafkaParserConfig; producerOnlyMode?: boolean; } | (MqttClientOptions & { url?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; subscribeOptions?: { qos: QoS; nl?: boolean; rap?: boolean; rh?: number; }; userProperties?: Record<string, string | string[]>; }) | { [key: string]: any; headers?: Record<string, string>; authenticator?: any; debug?: boolean; ignoreClusterUpdates?: boolean; inboxPrefix?: string; encoding?: string; name?: string; user?: string; pass?: string; maxPingOut?: number; maxReconnectAttempts?: number; reconnectTimeWait?: number; reconnectJitter?: number; reconnectJitterTLS?: number; reconnectDelayHandler?: any; servers?: string | string[]; nkey?: any; reconnect?: boolean; pedantic?: boolean; tls?: any; queue?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; userJWT?: string; nonceSigner?: any; userCreds?: any; useOldRequestStyle?: boolean; pingInterval?: number; preserveBuffers?: boolean; waitOnFirstConnect?: boolean; verbose?: boolean; noEcho?: boolean; noRandomize?: boolean; timeout?: number; token?: string; yieldTime?: number; tokenHandler?: any; } | ({ host?: string; port?: number; retryAttempts?: number; retryDelay?: number; wildcards?: boolean; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; } & IORedisOptions) | { host?: string; port?: number; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; tlsOptions?: ConnectionOptions; socketClass?: Type<TcpSocket>; } | { urls?: string[] | RmqUrl[]; queue?: string; prefetchCount?: number; isGlobalPrefetchCount?: boolean; queueOptions?: AmqplibQueueOptions; socketOptions?: AmqpConnectionManagerSocketOptions; noAck?: boolean; consumerTag?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; replyQueue?: string; persistent?: boolean; headers?: Record<string, string>; noAssert?: boolean; maxConnectionAttempts?: number; }, K extends keyof T>( obj: T, prop: K, defaultValue?: T[K]) => T[K];
method initializeDeserializer
protected initializeDeserializer: (options: ClientOptions['options']) => void;
method initializeSerializer
protected initializeSerializer: (options: ClientOptions['options']) => void;
method normalizePattern
protected normalizePattern: (pattern: MsPattern) => string;
method publish
protected abstract publish: ( packet: ReadPacket, callback: (packet: WritePacket) => void) => () => void;
method send
send: <TResult = any, TInput = any>( pattern: any, data: TInput) => Observable<TResult>;
method serializeError
protected serializeError: (err: any) => any;
method serializeResponse
protected serializeResponse: (response: any) => any;
class ClientProxyFactory
class ClientProxyFactory {}
method create
static create: { ( clientOptions: { transport: Transport.GRPC } & ClientOptions ): ClientGrpcProxy; (clientOptions: ClientOptions): ClientProxy & Closeable; (clientOptions: CustomClientOptions): ClientProxy & Closeable;};
class ClientRedis
class ClientRedis extends ClientProxy {}
constructor
constructor( options: { host?: string; port?: number; retryAttempts?: number; retryDelay?: number; wildcards?: boolean; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; } & IORedisOptions);
property connection
protected connection: Promise<any>;
property isExplicitlyTerminated
protected isExplicitlyTerminated: boolean;
property logger
protected readonly logger: Logger;
property options
protected readonly options: { host?: string; port?: number; retryAttempts?: number; retryDelay?: number; wildcards?: boolean; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>;} & IORedisOptions;
property pubClient
protected pubClient: any;
property subClient
protected subClient: any;
property subscriptionsCount
protected readonly subscriptionsCount: Map<string, number>;
method close
close: () => void;
method connect
connect: () => Promise<any>;
method createClient
createClient: () => Redis;
method createResponseCallback
createResponseCallback: () => (channel: string, buffer: string) => Promise<void>;
method createRetryStrategy
createRetryStrategy: (times: number) => undefined | number;
method dispatchEvent
protected dispatchEvent: (packet: ReadPacket) => Promise<any>;
method getClientOptions
getClientOptions: () => Partial<RedisOptions['options']>;
method getReplyPattern
getReplyPattern: (pattern: string) => string;
method getRequestPattern
getRequestPattern: (pattern: string) => string;
method handleError
handleError: (client: Redis) => void;
method publish
protected publish: ( partialPacket: ReadPacket, callback: (packet: WritePacket) => any) => () => void;
method unsubscribeFromChannel
protected unsubscribeFromChannel: (channel: string) => void;
class ClientRMQ
class ClientRMQ extends ClientProxy {}
constructor
constructor(options: { urls?: string[] | RmqUrl[]; queue?: string; prefetchCount?: number; isGlobalPrefetchCount?: boolean; queueOptions?: AmqplibQueueOptions; socketOptions?: AmqpConnectionManagerSocketOptions; noAck?: boolean; consumerTag?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; replyQueue?: string; persistent?: boolean; headers?: Record<string, string>; noAssert?: boolean; maxConnectionAttempts?: number;});
property channel
protected channel: any;
property client
protected client: any;
property connection
protected connection: Promise<any>;
property connection$
protected connection$: ReplaySubject<any>;
property logger
protected readonly logger: Logger;
property noAssert
protected noAssert: boolean;
property options
protected readonly options: { urls?: string[] | RmqUrl[]; queue?: string; prefetchCount?: number; isGlobalPrefetchCount?: boolean; queueOptions?: AmqplibQueueOptions; socketOptions?: AmqpConnectionManagerSocketOptions; noAck?: boolean; consumerTag?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; replyQueue?: string; persistent?: boolean; headers?: Record<string, string>; noAssert?: boolean; maxConnectionAttempts?: number;};
property persistent
protected persistent: boolean;
property queue
protected queue: string;
property queueOptions
protected queueOptions: Record<string, any>;
property replyQueue
protected replyQueue: string;
property responseEmitter
protected responseEmitter: EventEmitter;
property urls
protected urls: string[] | RmqUrl[];
method close
close: () => void;
method connect
connect: () => Promise<any>;
method consumeChannel
consumeChannel: (channel: Channel) => Promise<void>;
method convertConnectionToPromise
convertConnectionToPromise: () => Promise<any>;
method createChannel
createChannel: () => Promise<void>;
method createClient
createClient: () => AmqpConnectionManager;
method dispatchEvent
protected dispatchEvent: (packet: ReadPacket) => Promise<any>;
method handleDisconnectError
handleDisconnectError: (client: AmqpConnectionManager) => void;
method handleError
handleError: (client: AmqpConnectionManager) => void;
method handleMessage
handleMessage: { (packet: unknown, callback: (packet: WritePacket) => any): any; ( packet: unknown, options: Record<string, unknown>, callback: (packet: WritePacket<any>) => any ): any;};
method initializeSerializer
protected initializeSerializer: (options: RmqOptions['options']) => void;
method mergeDisconnectEvent
mergeDisconnectEvent: <T = any>( instance: any, source$: Observable<T>) => Observable<T>;
method mergeHeaders
protected mergeHeaders: ( requestHeaders?: Record<string, string>) => Record<string, string> | undefined;
method parseMessageContent
protected parseMessageContent: (content: Buffer) => any;
method publish
protected publish: ( message: ReadPacket, callback: (packet: WritePacket) => any) => () => void;
method setupChannel
setupChannel: (channel: Channel, resolve: Function) => Promise<void>;
class ClientsModule
class ClientsModule {}
method register
static register: (options: ClientsModuleOptions) => DynamicModule;
method registerAsync
static registerAsync: (options: ClientsModuleAsyncOptions) => DynamicModule;
class ClientTCP
class ClientTCP extends ClientProxy {}
constructor
constructor(options: { host?: string; port?: number; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; tlsOptions?: ConnectionOptions; socketClass?: Type<TcpSocket>;});
property connection
protected connection: Promise<any>;
property tlsOptions
tlsOptions?: ConnectionOptions;
method bindEvents
bindEvents: (socket: TcpSocket) => void;
method close
close: () => void;
method connect
connect: () => Promise<any>;
method createSocket
createSocket: () => TcpSocket;
method dispatchEvent
protected dispatchEvent: (packet: ReadPacket) => Promise<any>;
method handleClose
handleClose: () => void;
method handleError
handleError: (err: any) => void;
method handleResponse
handleResponse: (buffer: unknown) => Promise<void>;
method publish
protected publish: ( partialPacket: ReadPacket, callback: (packet: WritePacket) => any) => () => void;
class JsonSocket
class JsonSocket extends TcpSocket {}
method handleData
protected handleData: (dataRaw: Buffer | string) => void;
method handleSend
protected handleSend: (message: any, callback?: (err?: any) => void) => void;
class KafkaContext
class KafkaContext extends BaseRpcContext<KafkaContextArgs> {}
constructor
constructor(args: KafkaContextArgs);
method getConsumer
getConsumer: () => Consumer;
Returns the Kafka consumer reference.
method getHeartbeat
getHeartbeat: () => () => Promise<void>;
Returns the Kafka heartbeat callback.
method getMessage
getMessage: () => KafkaMessage;
Returns the reference to the original message.
method getPartition
getPartition: () => number;
Returns the partition.
method getProducer
getProducer: () => Producer;
Returns the Kafka producer reference,
method getTopic
getTopic: () => string;
Returns the name of the topic.
class KafkaParser
class KafkaParser {}
constructor
constructor(config?: KafkaParserConfig);
property keepBinary
protected readonly keepBinary: boolean;
method decode
decode: (value: Buffer) => object | string | null | Buffer;
method parse
parse: <T = any>(data: any) => T;
class KafkaReplyPartitionAssigner
class KafkaReplyPartitionAssigner {}
constructor
constructor(clientKafka: ClientKafka, config: { cluster: Cluster });
property name
readonly name: string;
property version
readonly version: number;
method assign
assign: (group: { members: GroupMember[]; topics: string[];}) => Promise<GroupMemberAssignment[]>;
This process can result in imbalanced assignments
Parameter members
array of members, e.g: [{ memberId: 'test-5f93f5a3' }]
Parameter topics
Parameter userData
Returns
{array} object partitions per topic per member
method decodeMember
decodeMember: (member: GroupMember) => { memberId: string; previousAssignment: any;};
method getPreviousAssignment
getPreviousAssignment: () => { [key: string]: number };
method protocol
protocol: (subscription: { topics: string[]; userData: Buffer }) => GroupState;
class KafkaRetriableException
class KafkaRetriableException extends RpcException {}
Exception that instructs Kafka driver to instead of introspecting error processing flow and sending serialized error message to the consumer, force bubble it up to the "eachMessage" callback of the underlying "kafkajs" package (even if interceptors are applied, or an observable stream is returned from the message handler).
A transient exception that if retried may succeed.
method getError
getError: () => string | object;
class MqttContext
class MqttContext extends BaseRpcContext<MqttContextArgs> {}
constructor
constructor(args: MqttContextArgs);
method getPacket
getPacket: () => Record<string, any>;
Returns the reference to the original MQTT packet.
method getTopic
getTopic: () => string;
Returns the name of the topic.
class MqttRecord
class MqttRecord<TData = any> {}
constructor
constructor(data: {}, options?: MqttRecordOptions);
property data
readonly data: {};
property options
options?: MqttRecordOptions;
class MqttRecordBuilder
class MqttRecordBuilder<TData> {}
constructor
constructor(data?: {});
method build
build: () => MqttRecord;
method setData
setData: (data: TData) => this;
method setDup
setDup: (dup: MqttRecordOptions['dup']) => this;
method setProperties
setProperties: (properties: MqttRecordOptions['properties']) => this;
method setQoS
setQoS: (qos: MqttRecordOptions['qos']) => this;
method setRetain
setRetain: (retain: MqttRecordOptions['retain']) => this;
class NatsContext
class NatsContext extends BaseRpcContext<NatsContextArgs> {}
constructor
constructor(args: NatsContextArgs);
method getHeaders
getHeaders: () => any;
Returns message headers (if exist).
method getSubject
getSubject: () => string;
Returns the name of the subject.
class NatsRecord
class NatsRecord<TData = any, THeaders = any> {}
constructor
constructor(data: {}, headers?: {});
property data
readonly data: {};
property headers
readonly headers?: {};
class NatsRecordBuilder
class NatsRecordBuilder<TData> {}
constructor
constructor(data?: {});
method build
build: () => NatsRecord;
method setData
setData: (data: TData) => this;
method setHeaders
setHeaders: <THeaders = any>(headers: THeaders) => this;
class NestMicroservice
class NestMicroservice extends NestApplicationContext<NestMicroserviceOptions> implements INestMicroservice {}
constructor
constructor( container: NestContainer, config: any, graphInspector: GraphInspector, applicationConfig: ApplicationConfig);
property logger
protected readonly logger: Logger;
method close
close: () => Promise<any>;
method closeApplication
protected closeApplication: () => Promise<any>;
method createServer
createServer: (config: NestMicroserviceOptions & MicroserviceOptions) => void;
method dispose
protected dispose: () => Promise<void>;
method init
init: () => Promise<this>;
method listen
listen: () => Promise<any>;
method registerListeners
registerListeners: () => void;
method registerModules
registerModules: () => Promise<any>;
method setIsInitHookCalled
setIsInitHookCalled: (isInitHookCalled: boolean) => void;
method setIsInitialized
setIsInitialized: (isInitialized: boolean) => void;
method setIsTerminated
setIsTerminated: (isTerminated: boolean) => void;
method useGlobalFilters
useGlobalFilters: (...filters: ExceptionFilter[]) => this;
method useGlobalGuards
useGlobalGuards: (...guards: CanActivate[]) => this;
method useGlobalInterceptors
useGlobalInterceptors: (...interceptors: NestInterceptor[]) => this;
method useGlobalPipes
useGlobalPipes: (...pipes: PipeTransform<any>[]) => this;
method useWebSocketAdapter
useWebSocketAdapter: (adapter: WebSocketAdapter) => this;
class RedisContext
class RedisContext extends BaseRpcContext<RedisContextArgs> {}
constructor
constructor(args: RedisContextArgs);
method getChannel
getChannel: () => string;
Returns the name of the channel.
class RmqContext
class RmqContext extends BaseRpcContext<RmqContextArgs> {}
constructor
constructor(args: RmqContextArgs);
method getChannelRef
getChannelRef: () => any;
Returns the reference to the original RMQ channel.
method getMessage
getMessage: () => Record<string, any>;
Returns the original message (with properties, fields, and content).
method getPattern
getPattern: () => string;
Returns the name of the pattern.
class RmqRecord
class RmqRecord<TData = any> {}
constructor
constructor(data: {}, options?: RmqRecordOptions);
property data
readonly data: {};
property options
options?: RmqRecordOptions;
class RmqRecordBuilder
class RmqRecordBuilder<TData> {}
constructor
constructor(data?: {});
method build
build: () => RmqRecord;
method setData
setData: (data: TData) => this;
method setOptions
setOptions: (options: RmqRecordOptions) => this;
class RpcException
class RpcException extends Error {}
constructor
constructor(error: string | object);
method getError
getError: () => string | object;
method initMessage
initMessage: () => void;
class Server
abstract class Server {}
property deserializer
protected deserializer: ConsumerDeserializer;
property logger
protected readonly logger: LoggerService;
property messageHandlers
protected readonly messageHandlers: Map<string, MessageHandler<any, any, any>>;
property serializer
protected serializer: ConsumerSerializer;
method addHandler
addHandler: ( pattern: any, callback: MessageHandler, isEventHandler?: boolean, extras?: Record<string, any>) => void;
method getHandlerByPattern
getHandlerByPattern: (pattern: string) => MessageHandler | null;
method getHandlers
getHandlers: () => Map<string, MessageHandler>;
method getOptionsProp
getOptionsProp: < T extends | {} | { url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutDataMs?: number; http2MaxPingStrikes?: number; }; channelOptions?: ChannelOptions; credentials?: any; protoPath?: string | string[]; package: string | string[]; protoLoader?: string; packageDefinition?: any; gracefulShutdown?: boolean; onLoadPackageDefinition?: (pkg: any, server: any) => void; loader?: { keepCase?: boolean; alternateCommentMode?: boolean; longs?: Function; enums?: Function; bytes?: Function; defaults?: boolean; arrays?: boolean; objects?: boolean; oneofs?: boolean; json?: boolean; includeDirs?: string[]; }; } | { postfixId?: string; client?: KafkaConfig; consumer?: ConsumerConfig; run?: Omit<ConsumerRunConfig, 'eachBatch' | 'eachMessage'>; subscribe?: Omit<ConsumerSubscribeTopics, 'topics'>; producer?: ProducerConfig; send?: Omit<ProducerRecord, 'topic' | 'messages'>; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; parser?: KafkaParserConfig; producerOnlyMode?: boolean; } | (MqttClientOptions & { url?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; subscribeOptions?: { qos: QoS; nl?: boolean; rap?: boolean; rh?: number; }; userProperties?: Record<string, string | string[]>; }) | { [key: string]: any; headers?: Record<string, string>; authenticator?: any; debug?: boolean; ignoreClusterUpdates?: boolean; inboxPrefix?: string; encoding?: string; name?: string; user?: string; pass?: string; maxPingOut?: number; maxReconnectAttempts?: number; reconnectTimeWait?: number; reconnectJitter?: number; reconnectJitterTLS?: number; reconnectDelayHandler?: any; servers?: string | string[]; nkey?: any; reconnect?: boolean; pedantic?: boolean; tls?: any; queue?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; userJWT?: string; nonceSigner?: any; userCreds?: any; useOldRequestStyle?: boolean; pingInterval?: number; preserveBuffers?: boolean; waitOnFirstConnect?: boolean; verbose?: boolean; noEcho?: boolean; noRandomize?: boolean; timeout?: number; token?: string; yieldTime?: number; tokenHandler?: any; } | ({ host?: string; port?: number; retryAttempts?: number; retryDelay?: number; wildcards?: boolean; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; } & IORedisOptions) | { urls?: string[] | RmqUrl[]; queue?: string; prefetchCount?: number; isGlobalPrefetchCount?: boolean; queueOptions?: AmqplibQueueOptions; socketOptions?: AmqpConnectionManagerSocketOptions; noAck?: boolean; consumerTag?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; replyQueue?: string; persistent?: boolean; headers?: Record<string, string>; noAssert?: boolean; maxConnectionAttempts?: number; } | { host?: string; port?: number; retryAttempts?: number; retryDelay?: number; serializer?: Serializer<any, any>; tlsOptions?: ConnectionOptions; deserializer?: Deserializer<any, any>; socketClass?: Type<TcpSocket>; }, K extends keyof T>( obj: T, prop: K, defaultValue?: T[K]) => T[K];
method getRouteFromPattern
protected getRouteFromPattern: (pattern: string) => string;
Transforms the server Pattern to valid type and returns a route for him.
Parameter pattern
server pattern
Returns
string
method handleError
protected handleError: (error: string) => void;
method handleEvent
handleEvent: ( pattern: string, packet: ReadPacket, context: BaseRpcContext) => Promise<any>;
method initializeDeserializer
protected initializeDeserializer: (options: ClientOptions['options']) => void;
method initializeSerializer
protected initializeSerializer: (options: ClientOptions['options']) => void;
method loadPackage
protected loadPackage: <T = any>( name: string, ctx: string, loader?: Function) => T;
method normalizePattern
protected normalizePattern: (pattern: MsPattern) => string;
method send
send: ( stream$: Observable<any>, respond: (data: WritePacket) => unknown | Promise<unknown>) => Subscription;
method transformToObservable
transformToObservable: { <T>(resultOrDeferred: Observable<T> | Promise<T>): Observable<T>; <T>(resultOrDeferred: T): Observable<T>;};
class ServerGrpc
class ServerGrpc extends Server implements CustomTransportStrategy {}
constructor
constructor(options: { url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutDataMs?: number; http2MaxPingStrikes?: number; }; channelOptions?: ChannelOptions; credentials?: any; protoPath?: string | string[]; package: string | string[]; protoLoader?: string; packageDefinition?: any; gracefulShutdown?: boolean; onLoadPackageDefinition?: (pkg: any, server: any) => void; loader?: { keepCase?: boolean; alternateCommentMode?: boolean; longs?: Function; enums?: Function; bytes?: Function; defaults?: boolean; arrays?: boolean; objects?: boolean; oneofs?: boolean; json?: boolean; includeDirs?: string[]; };});
property transportId
readonly transportId: number;
method addHandler
addHandler: ( pattern: unknown, callback: MessageHandler, isEventHandler?: boolean) => void;
method bindEvents
bindEvents: () => Promise<void>;
method close
close: () => Promise<void>;
method createClient
createClient: () => Promise<any>;
method createPattern
createPattern: ( service: string, methodName: string, streaming: GrpcMethodStreamingType) => string;
Will create a string of a JSON serialized format
Parameter service
name of the service which should be a match to gRPC service definition name
Parameter methodName
name of the method which is coming after rpc keyword
Parameter streaming
GrpcMethodStreamingType parameter which should correspond to stream keyword in gRPC service request part
method createRequestStreamMethod
createRequestStreamMethod: ( methodHandler: Function, isResponseStream: boolean) => ( call: GrpcCall, callback: (err: unknown, value: unknown) => void) => Promise<void>;
method createService
createService: (grpcService: any, name: string) => Promise<{}>;
Will create service mapping from gRPC generated Object to handlers defined with or annotations
Parameter grpcService
Parameter name
method createServiceMethod
createServiceMethod: ( methodHandler: Function, protoNativeHandler: any, streamType: GrpcMethodStreamingType) => Function;
Will return async function which will handle gRPC call with Rx streams or as a direct call passthrough
Parameter methodHandler
Parameter protoNativeHandler
Parameter streamType
method createStreamCallMethod
createStreamCallMethod: ( methodHandler: Function, isResponseStream: boolean) => ( call: GrpcCall, callback: (err: unknown, value: unknown) => void) => Promise<void>;
method createStreamServiceMethod
createStreamServiceMethod: (methodHandler: Function) => Function;
method createUnaryServiceMethod
createUnaryServiceMethod: (methodHandler: Function) => Function;
method deserialize
deserialize: (obj: any) => any;
method getMessageHandler
getMessageHandler: ( serviceName: string, methodName: string, streaming: GrpcMethodStreamingType, grpcMethod: { path?: string }) => MessageHandler<any, any, any>;
method getServiceNames
getServiceNames: (grpcPkg: any) => { name: string; service: any }[];
Will return all of the services along with their fully namespaced names as an array of objects. This method initiates recursive scan of grpcPkg object
method listen
listen: ( callback: (err?: unknown, ...optionalParams: unknown[]) => void) => Promise<void>;
method loadProto
loadProto: () => any;
method lookupPackage
lookupPackage: (root: any, packageName: string) => any;
method start
start: (callback?: () => void) => Promise<void>;
class ServerKafka
class ServerKafka extends Server implements CustomTransportStrategy {}
constructor
constructor(options: { postfixId?: string; client?: KafkaConfig; consumer?: ConsumerConfig; run?: Omit<ConsumerRunConfig, 'eachBatch' | 'eachMessage'>; subscribe?: Omit<ConsumerSubscribeTopics, 'topics'>; producer?: ProducerConfig; send?: Omit<ProducerRecord, 'topic' | 'messages'>; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; parser?: KafkaParserConfig; producerOnlyMode?: boolean;});
property brokers
protected brokers: string[] | BrokersFunction;
property client
protected client: Kafka;
property clientId
protected clientId: string;
property consumer
protected consumer: Consumer;
property groupId
protected groupId: string;
property logger
protected logger: Logger;
property options
protected readonly options: { postfixId?: string; client?: KafkaConfig; consumer?: ConsumerConfig; run?: Omit<ConsumerRunConfig, 'eachBatch' | 'eachMessage'>; subscribe?: Omit<ConsumerSubscribeTopics, 'topics'>; producer?: ProducerConfig; send?: Omit<ProducerRecord, 'topic' | 'messages'>; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; parser?: KafkaParserConfig; producerOnlyMode?: boolean;};
property parser
protected parser: KafkaParser;
property producer
protected producer: Producer;
property transportId
readonly transportId: number;
method assignCorrelationIdHeader
assignCorrelationIdHeader: ( correlationId: string, outgoingMessage: Message) => void;
method assignErrorHeader
assignErrorHeader: ( outgoingResponse: OutgoingResponse, outgoingMessage: Message) => void;
method assignIsDisposedHeader
assignIsDisposedHeader: ( outgoingResponse: OutgoingResponse, outgoingMessage: Message) => void;
method assignReplyPartition
assignReplyPartition: (replyPartition: string, outgoingMessage: Message) => void;
method bindEvents
bindEvents: (consumer: Consumer) => Promise<void>;
method close
close: () => Promise<void>;
method createClient
createClient: <T = any>() => T;
method getMessageHandler
getMessageHandler: () => (payload: EachMessagePayload) => Promise<any>;
method getPublisher
getPublisher: ( replyTopic: string, replyPartition: string, correlationId: string) => (data: any) => Promise<RecordMetadata[]>;
method handleEvent
handleEvent: ( pattern: string, packet: ReadPacket, context: KafkaContext) => Promise<any>;
method handleMessage
handleMessage: (payload: EachMessagePayload) => Promise<any>;
method initializeDeserializer
protected initializeDeserializer: (options: KafkaOptions['options']) => void;
method initializeSerializer
protected initializeSerializer: (options: KafkaOptions['options']) => void;
method listen
listen: ( callback: (err?: unknown, ...optionalParams: unknown[]) => void) => Promise<void>;
method sendMessage
sendMessage: ( message: OutgoingResponse, replyTopic: string, replyPartition: string, correlationId: string) => Promise<RecordMetadata[]>;
method start
start: (callback: () => void) => Promise<void>;
class ServerMqtt
class ServerMqtt extends Server implements CustomTransportStrategy {}
constructor
constructor( options: MqttClientOptions & { url?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; subscribeOptions?: { qos: QoS; nl?: boolean; rap?: boolean; rh?: number; }; userProperties?: Record<string, string | string[]>; });
property mqttClient
protected mqttClient: MqttClient;
property transportId
readonly transportId: number;
method bindEvents
bindEvents: (mqttClient: MqttClient) => void;
method close
close: () => void;
method createMqttClient
createMqttClient: () => MqttClient;
method getHandlerByPattern
getHandlerByPattern: (pattern: string) => MessageHandler | null;
method getMessageHandler
getMessageHandler: (pub: MqttClient) => Function;
method getPublisher
getPublisher: (client: MqttClient, pattern: any, id: string) => any;
method getReplyPattern
getReplyPattern: (pattern: string) => string;
method getRequestPattern
getRequestPattern: (pattern: string) => string;
method handleError
handleError: (stream: any) => void;
method handleMessage
handleMessage: ( channel: string, buffer: Buffer, pub: MqttClient, originalPacket?: Record<string, any>) => Promise<any>;
method initializeSerializer
protected initializeSerializer: (options: MqttOptions['options']) => void;
method listen
listen: ( callback: (err?: unknown, ...optionalParams: unknown[]) => void) => Promise<void>;
method matchMqttPattern
matchMqttPattern: (pattern: string, topic: string) => boolean;
method parseMessage
parseMessage: (content: any) => ReadPacket & PacketId;
method removeHandlerKeySharedPrefix
removeHandlerKeySharedPrefix: (handlerKey: string) => string;
method start
start: (callback: (err?: unknown, ...optionalParams: unknown[]) => void) => void;
class ServerNats
class ServerNats extends Server implements CustomTransportStrategy {}
constructor
constructor(options: { [key: string]: any; headers?: Record<string, string>; authenticator?: any; debug?: boolean; ignoreClusterUpdates?: boolean; inboxPrefix?: string; encoding?: string; name?: string; user?: string; pass?: string; maxPingOut?: number; maxReconnectAttempts?: number; reconnectTimeWait?: number; reconnectJitter?: number; reconnectJitterTLS?: number; reconnectDelayHandler?: any; servers?: string | string[]; nkey?: any; reconnect?: boolean; pedantic?: boolean; tls?: any; queue?: string; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; userJWT?: string; nonceSigner?: any; userCreds?: any; useOldRequestStyle?: boolean; pingInterval?: number; preserveBuffers?: boolean; waitOnFirstConnect?: boolean; verbose?: boolean; noEcho?: boolean; noRandomize?: boolean; timeout?: number; token?: string; yieldTime?: number; tokenHandler?: any;});
property transportId
readonly transportId: number;
method bindEvents
bindEvents: (client: Client) => void;
method close
close: () => Promise<void>;
method createNatsClient
createNatsClient: () => Promise<Client>;
method getMessageHandler
getMessageHandler: (channel: string) => Function;
method getPublisher
getPublisher: ( natsMsg: NatsMsg, id: string) => ((response: any) => boolean) | (() => void);
method handleMessage
handleMessage: (channel: string, natsMsg: NatsMsg) => Promise<any>;
method handleStatusUpdates
handleStatusUpdates: (client: Client) => Promise<void>;
method initializeDeserializer
protected initializeDeserializer: (options: NatsOptions['options']) => void;
method initializeSerializer
protected initializeSerializer: (options: NatsOptions['options']) => void;
method listen
listen: ( callback: (err?: unknown, ...optionalParams: unknown[]) => void) => Promise<void>;
method start
start: (callback: (err?: unknown, ...optionalParams: unknown[]) => void) => void;
class ServerRedis
class ServerRedis extends Server implements CustomTransportStrategy {}
constructor
constructor( options: { host?: string; port?: number; retryAttempts?: number; retryDelay?: number; wildcards?: boolean; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; } & IORedisOptions);
property transportId
readonly transportId: number;
method bindEvents
bindEvents: (subClient: Redis, pubClient: Redis) => void;
method close
close: () => void;
method createRedisClient
createRedisClient: () => Redis;
method createRetryStrategy
createRetryStrategy: (times: number) => undefined | number | void;
method getClientOptions
getClientOptions: () => Partial<RedisOptions['options']>;
method getMessageHandler
getMessageHandler: ( pub: