UNPKG

1.47 kBTypeScriptView Raw
1import { Transport } from '../enums';
2import { ClientOpts, RedisClient, RetryStrategyOptions } from '../external/redis.interface';
3import { CustomTransportStrategy } from '../interfaces';
4import { RedisOptions } from '../interfaces/microservice-configuration.interface';
5import { Server } from './server';
6export declare class ServerRedis extends Server implements CustomTransportStrategy {
7 private readonly options;
8 readonly transportId = Transport.REDIS;
9 private readonly url;
10 private subClient;
11 private pubClient;
12 private isExplicitlyTerminated;
13 constructor(options: RedisOptions['options']);
14 listen(callback: (err?: unknown, ...optionalParams: unknown[]) => void): void;
15 start(callback?: () => void): void;
16 bindEvents(subClient: RedisClient, pubClient: RedisClient): void;
17 close(): void;
18 createRedisClient(): RedisClient;
19 getMessageHandler(pub: RedisClient): (channel: string, buffer: string | any) => Promise<any>;
20 handleMessage(channel: string, buffer: string | any, pub: RedisClient): Promise<any>;
21 getPublisher(pub: RedisClient, pattern: any, id: string): (response: any) => boolean;
22 parseMessage(content: any): Record<string, any>;
23 getRequestPattern(pattern: string): string;
24 getReplyPattern(pattern: string): string;
25 handleError(stream: any): void;
26 getClientOptions(): Partial<ClientOpts>;
27 createRetryStrategy(options: RetryStrategyOptions): undefined | number | void;
28}