abstract class ClientProxy {
protected routingMap: Map<string, Function>
protected serializer: ProducerSerializer
protected deserializer: ProducerDeserializer
abstract connect(): Promise<any>
abstract close(): any
send<TResult = any, TInput = any>(pattern: any, data: TInput): Observable<TResult>
emit<TResult = any, TInput = any>(pattern: any, data: TInput): Observable<TResult>
protected abstract publish(packet: ReadPacket<any>, callback: (packet: WritePacket<any>) => void): () => void
protected abstract dispatchEvent<T = any>(packet: ReadPacket<any>): Promise<T>
protected createObserver<T>(observer: Observer<T>): (packet: WritePacket) => void
protected serializeError(err: any): any
protected serializeResponse(response: any): any
protected assignPacketId(packet: ReadPacket<any>): ReadPacket & PacketId
protected connect$(instance: any, errorEvent: string = ERROR_EVENT, connectEvent: string = CONNECT_EVENT): Observable<any>
protected getOptionsProp<T extends ClientOptions['options'], K extends keyof T>(obj: T, prop: K, defaultValue: T[K] = undefined)
protected normalizePattern(pattern: MsPattern): string
protected initializeSerializer(options: { url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutData...)
protected initializeDeserializer(options: { url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutData...)
}
Methods
connect()
|
abstract connect(): Promise<any>
Parameters
There are no parameters.
Returns
Promise<any>
|
close()
|
abstract close(): any
Parameters
There are no parameters.
Returns
any
|
send()
|
send<TResult = any, TInput = any>(pattern: any, data: TInput): Observable<TResult>
Parameters
Option |
Type |
Description |
pattern
|
any |
|
data
|
TInput |
|
Returns
Observable<TResult>
|
emit()
|
emit<TResult = any, TInput = any>(pattern: any, data: TInput): Observable<TResult>
Parameters
Option |
Type |
Description |
pattern
|
any |
|
data
|
TInput |
|
Returns
Observable<TResult>
|
publish()
|
protected abstract publish(packet: ReadPacket<any>, callback: (packet: WritePacket<any>) => void): () => void
Parameters
Returns
() => void
|
dispatchEvent()
|
protected abstract dispatchEvent<T = any>(packet: ReadPacket<any>): Promise<T>
Parameters
Returns
Promise<T>
|
createObserver()
|
protected createObserver<T>(observer: Observer<T>): (packet: WritePacket) => void
Parameters
Option |
Type |
Description |
observer
|
Observer |
|
Returns
(packet: WritePacket) => void
|
serializeError()
|
protected serializeError(err: any): any
Parameters
Option |
Type |
Description |
err
|
any |
|
Returns
any
|
serializeResponse()
|
protected serializeResponse(response: any): any
Parameters
Option |
Type |
Description |
response
|
any |
|
Returns
any
|
assignPacketId()
|
protected assignPacketId(packet: ReadPacket<any>): ReadPacket & PacketId
Parameters
Returns
ReadPacket & PacketId
|
connect$()
|
protected connect$(instance: any, errorEvent: string = ERROR_EVENT, connectEvent: string = CONNECT_EVENT): Observable<any>
Parameters
Option |
Type |
Description |
instance
|
any |
|
errorEvent
|
string |
Optional. Default is ERROR_EVENT .
|
connectEvent
|
string |
Optional. Default is CONNECT_EVENT .
|
Returns
Observable<any>
|
getOptionsProp()
|
protected getOptionsProp<T extends ClientOptions['options'], K extends keyof T>(obj: T, prop: K, defaultValue: T[K] = undefined)
Parameters
Option |
Type |
Description |
obj
|
T |
|
prop
|
K |
|
defaultValue
|
T[K] |
Optional. Default is undefined .
|
|
normalizePattern()
|
protected normalizePattern(pattern: MsPattern): string
Parameters
Returns
string
|
initializeSerializer()
|
protected initializeSerializer(options: { url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutData...)
Parameters
Option |
Type |
Description |
options
|
{ url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutData... |
|
|
initializeDeserializer()
|
protected initializeDeserializer(options: { url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutData...)
Parameters
Option |
Type |
Description |
options
|
{ url?: string; maxSendMessageLength?: number; maxReceiveMessageLength?: number; maxMetadataSize?: number; keepalive?: { keepaliveTimeMs?: number; keepaliveTimeoutMs?: number; keepalivePermitWithoutCalls?: number; http2MaxPingsWithoutData?: number; http2MinTimeBetweenPingsMs?: number; http2MinPingIntervalWithoutData... |
|
|