Features
Docs
CLI
Benchmarks
Examples

© 2024 MoroJs

@morojs/moro


@morojs/moro / GrpcAdapter

Interface: GrpcAdapter

Defined in: src/core/grpc/grpc-adapter.ts:19

Base adapter interface for gRPC implementations All gRPC adapters (@grpc/grpc-js, grpc-web) must implement this interface

Methods

addService()

addService(serviceName, serviceDefinition, implementation): ServiceRegistration

Defined in: src/core/grpc/grpc-adapter.ts:37

Register a gRPC service with implementation

Parameters

serviceName

string

serviceDefinition

ServiceDefinition

implementation

ServiceImplementation

Returns

ServiceRegistration


createClient()

createClient(protoPath, serviceName, options): Promise<GrpcClient>

Defined in: src/core/grpc/grpc-adapter.ts:56

Create a gRPC client for calling remote services

Parameters

protoPath

string

serviceName

string

options

GrpcClientOptions

Returns

Promise<GrpcClient>


enableHealthCheck()

enableHealthCheck(): void

Defined in: src/core/grpc/grpc-adapter.ts:65

Enable health checking service

Returns

void


enableReflection()

enableReflection(): void

Defined in: src/core/grpc/grpc-adapter.ts:70

Enable server reflection

Returns

void


getAdapterName()

getAdapterName(): string

Defined in: src/core/grpc/grpc-adapter.ts:75

Get adapter name

Returns

string


initialize()

initialize(options): Promise<void>

Defined in: src/core/grpc/grpc-adapter.ts:23

Initialize the gRPC adapter

Parameters

options

GrpcOptions

Returns

Promise<void>


isAvailable()

isAvailable(): Promise<boolean>

Defined in: src/core/grpc/grpc-adapter.ts:80

Check if adapter is available

Returns

Promise<boolean>


loadProto()

loadProto(protoPath, packageName?, options?): Promise<ServiceDefinition[]>

Defined in: src/core/grpc/grpc-adapter.ts:28

Load a proto file and return service definitions

Parameters

protoPath

string

packageName?

string

options?

ProtoLoadOptions

Returns

Promise<ServiceDefinition[]>


start()

start(): Promise<GrpcServer>

Defined in: src/core/grpc/grpc-adapter.ts:46

Start the gRPC server

Returns

Promise<GrpcServer>


stop()

stop(): Promise<void>

Defined in: src/core/grpc/grpc-adapter.ts:51

Stop the gRPC server

Returns

Promise<void>