class ClientRedis extends ClientProxy {
constructor(options: { host?: string; port?: number; retryAttempts?: number; retryDelay?: number; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; } & IORedisOptions)
protected logger: Logger
protected subscriptionsCount: Map<string, number>
protected pubClient: Redis
protected subClient: Redis
protected connection: Promise<any>
protected isExplicitlyTerminated: false
protected options: RedisOptions['options']
getRequestPattern(pattern: string): string
getReplyPattern(pattern: string): string
close()
connect(): Promise<any>
createClient(): Redis
handleError(client: any)
getClientOptions(): Partial<RedisOptions['options']>
createRetryStrategy(times: number): undefined | number
createResponseCallback(): (channel: string, buffer: string) => Promise<void>
protected publish(partialPacket: ReadPacket<any>, callback: (packet: WritePacket<any>) => any): () => void
protected dispatchEvent(packet: ReadPacket<any>): Promise<any>
protected unsubscribeFromChannel(channel: string)
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...)
}
Constructor
constructor(options: { host?: string; port?: number; retryAttempts?: number; retryDelay?: number; serializer?: Serializer<any, any>; deserializer?: Deserializer<any, any>; } & IORedisOptions)
Parameters
Option |
Type |
Description |
options
|
{ host?: string; port?: number; retryAttempts?: number; retryDelay?: number; serializer?: Serializer; deserializer?: Deserializer; } & IORedisOptions |
|
|
Properties
Property |
Description |
protected logger: Logger
|
Read-only.
|
protected subscriptionsCount: Map<string, number>
|
Read-only.
|
protected pubClient: Redis
|
|
protected subClient: Redis
|
|
protected connection: Promise<any>
|
|
protected isExplicitlyTerminated: false
|
|
protected options: RedisOptions['options']
|
Read-only.
Declared in constructor.
|
Methods
getRequestPattern()
|
getRequestPattern(pattern: string): string
Parameters
Option |
Type |
Description |
pattern
|
string |
|
Returns
string
|
getReplyPattern()
|
getReplyPattern(pattern: string): string
Parameters
Option |
Type |
Description |
pattern
|
string |
|
Returns
string
|
close()
|
close()
Parameters
There are no parameters.
|
connect()
|
connect(): Promise<any>
Parameters
There are no parameters.
Returns
Promise<any>
|
createClient()
|
createClient(): Redis
Parameters
There are no parameters.
Returns
Redis
|
handleError()
|
handleError(client: any)
Parameters
Option |
Type |
Description |
client
|
any |
|
|
getClientOptions()
|
getClientOptions(): Partial<RedisOptions['options']>
Parameters
There are no parameters.
Returns
Partial<RedisOptions['options']>
|
createRetryStrategy()
|
createRetryStrategy(times: number): undefined | number
Parameters
Option |
Type |
Description |
times
|
number |
|
Returns
undefined | number
|
createResponseCallback()
|
createResponseCallback(): (channel: string, buffer: string) => Promise<void>
Parameters
There are no parameters.
Returns
(channel: string, buffer: string) => Promise<void>
|
publish()
|
protected publish(partialPacket: ReadPacket<any>, callback: (packet: WritePacket<any>) => any): () => void
Parameters
Returns
() => void
|
dispatchEvent()
|
protected dispatchEvent(packet: ReadPacket<any>): Promise<any>
Parameters
Returns
Promise<any>
|
unsubscribeFromChannel()
|
protected unsubscribeFromChannel(channel: string)
Parameters
Option |
Type |
Description |
channel
|
string |
|
|