Server
GrpcServer listens for incoming gRPC calls and dispatches them to registered service implementations.
Multiple services can be registered in the same services block:
Configuration
- credentials
Sets server credentials. By default the server uses plaintext. Use
tls(certificateChain, privateKey) { ... }for secure communication.- messageMarshallerResolver
A
GrpcMarshallerResolverfor custom serialization. Not needed when using generated Protobuf types. See No proto.- intercept(...)
Adds server-side interceptors for cross-cutting concerns like authentication, logging, or metrics.
- fallbackHandlerRegistry
A custom
GrpcHandlerRegistryfor resolving services that were not registered viaservices { ... }. Unresolved services returnUNIMPLEMENTEDstatus by default.
Lifecycle
Call start() to begin listening for connections. Use shutdown() for an orderly shutdown (existing calls finish, new calls are rejected) or shutdownNow() to cancel everything immediately. awaitTermination() blocks until all calls have completed.