UNPKG

1.24 kBTypeScriptView Raw
1import { Transport } from '../enums';
2import { Client, NatsMsg } from '../external/nats-client.interface';
3import { CustomTransportStrategy } from '../interfaces';
4import { NatsOptions } from '../interfaces/microservice-configuration.interface';
5import { Server } from './server';
6/**
7 * @publicApi
8 */
9export declare class ServerNats extends Server implements CustomTransportStrategy {
10 private readonly options;
11 readonly transportId = Transport.NATS;
12 private natsClient;
13 constructor(options: NatsOptions['options']);
14 listen(callback: (err?: unknown, ...optionalParams: unknown[]) => void): Promise<void>;
15 start(callback: (err?: unknown, ...optionalParams: unknown[]) => void): void;
16 bindEvents(client: Client): void;
17 close(): Promise<void>;
18 createNatsClient(): Promise<Client>;
19 getMessageHandler(channel: string): Function;
20 handleMessage(channel: string, natsMsg: NatsMsg): Promise<any>;
21 getPublisher(natsMsg: NatsMsg, id: string): ((response: any) => boolean) | (() => void);
22 handleStatusUpdates(client: Client): Promise<void>;
23 protected initializeSerializer(options: NatsOptions['options']): void;
24 protected initializeDeserializer(options: NatsOptions['options']): void;
25}