@nestjs/microservices
Version:
Microservices for NestJS: message and event handlers over Kafka, RabbitMQ, NATS, Redis, MQTT, gRPC or TCP.
59 lines (58 loc) • 2.94 kB
TypeScript
import { Observable, Subscriber, Subscription } from 'rxjs';
import { ClientGrpc, GrpcOptions } from '../interfaces/index.js';
import { ClientProxy } from './client-proxy.js';
import { Logger } from '@nestjs/common';
type GrpcClient = any;
/**
* @publicApi
*/
export declare class ClientGrpcProxy extends ClientProxy<never, never> implements ClientGrpc {
protected readonly options: Required<GrpcOptions>['options'];
protected readonly logger: Logger;
protected readonly clients: Map<string, any>;
protected readonly url: string;
protected grpcClients: GrpcClient[];
get status(): never;
constructor(options: Required<GrpcOptions>['options']);
getService<T extends object>(name: string): T;
getClientByServiceName<T = unknown>(name: string): T;
createClientByServiceName(name: string): any;
getKeepaliveOptions(): {};
createServiceMethod(client: any, methodName: string): (...args: unknown[]) => Observable<unknown>;
createStreamServiceMethod(client: unknown, methodName: string): (...args: any[]) => Observable<any>;
createUnaryServiceMethod(client: any, methodName: string): (...args: any[]) => Observable<any>;
/**
* Writes the values of a request stream to the call, and ends the call once
* the stream completes.
*
* The call is an object mode stream, whose "write" throws on null where
* nothing catches it, so null fails the call instead, as a null response
* does on the server. What a request stream emits synchronously after the
* null, while it cannot be unsubscribed from yet, is not sent either, so
* the server cannot take the rest of the stream for all of it.
*/
protected writeRequestStream(call: any, upstream: any, observer: Subscriber<unknown>): Subscription;
private createNullRequestError;
/**
* Runs the dispatch hook for a call - gRPC calls do not go through `send()`
* or `emit()` - once per subscription, in the subscriber's context.
*
* Returns the arguments to make the call with: the caller's, with the
* metadata the hook attached added to the call's `Metadata` under every key
* the caller did not set. A `Metadata` the caller passed is cloned rather
* than changed, as it may be reused for other calls.
*/
protected applyDispatchHook(client: any, methodName: string, args: any[]): any[];
createClients(): any[];
loadProto(): any;
lookupPackage(root: any, packageName: string): any;
close(): void;
connect(): Promise<any>;
send<TResult = any, TInput = any>(pattern: any, data: TInput): Observable<TResult>;
protected getClient(name: string): any;
protected publish(packet: any, callback: (packet: any) => any): any;
protected dispatchEvent(packet: any): Promise<any>;
on<EventKey extends never = never, EventCallback = any>(event: EventKey, callback: EventCallback): void;
unwrap<T>(): T;
}
export {};