Forge
1.x
Docs/Forge/Functions
Open

Reading1 min
Updated31 Jul 2026
Sourcev1/extensions/grpc/functions.mdx

Extension Entry Points01

FunctionDescription
NewExtension(opts ...ConfigOption) forge.ExtensionCreate the gRPC extension with functional options
NewExtensionWithConfig(config Config) forge.ExtensionCreate the gRPC extension with a complete config
DefaultConfig() ConfigReturns the default configuration

GRPC Interface -- Service Registration02

MethodDescription
RegisterService(desc *grpc.ServiceDesc, impl any)Register a gRPC service implementation
GetServiceInfo() []ServiceInfoList all registered services and their methods

GRPC Interface -- Server Lifecycle03

MethodDescription
Start(ctx) errorStart the gRPC server listener
Stop(ctx) errorGraceful shutdown of the server
Health(ctx) errorRun health checks on registered services

GRPC Interface -- Interceptors04

MethodDescription
AddUnaryInterceptor(interceptor)Add a unary server interceptor
AddStreamInterceptor(interceptor)Add a stream server interceptor

GRPC Interface -- Health05

MethodDescription
RegisterHealthChecker(name, checker)Register a named health checker
SetServingStatus(service, status)Set the serving status for a service

GRPC Interface -- Stats06

MethodDescription
Stats() ServerStatsGet server statistics
GetServer() *grpc.ServerAccess the underlying grpc.Server

Key Types07

ServiceInfo

FieldTypePurpose
NamestringFully qualified service name
Methods[]MethodInfoService methods
DescriptionstringService description

MethodInfo

FieldTypePurpose
NamestringMethod name
IsClientStreamboolClient streams requests
IsServerStreamboolServer streams responses
InputTypestringInput message type
OutputTypestringOutput message type