GrpcServerCallScope
Available in a dev version: 0․11․0-grpc-186
How to configure
The scope of a single incoming gRPC server call observed by a GrpcServerInterceptor.
An interceptor receives this scope instance for every RPC invocation arriving to the server and can:
Inspect the target RPC method.
Read client-provided requestHeaders.
Populate responseHeaders (sent before the first response message) and responseTrailers (sent when the call completes).
Register a completion callback with onClose.
Abort the call early with close.
Continue handling by calling proceed with the inbound request Flow and optionally transform the returned response Flow.
Type Parameters
the request message type of the RPC.
the response message type of the RPC.
Properties
The GrpcContext associated with this call.
Descriptor of the RPC method (name, marshalling, type) being executed.
Metadata received from the client with the initial request headers. Read-only from the server perspective.
Initial response headers to be sent to the client. Interceptors and handlers may add entries before the first response element is emitted (i.e., before proceeding or before producing output), otherwise headers might have already been sent.
Trailing metadata to be sent with the final status when the call completes. Interceptors can add diagnostics or custom metadata here.
Functions
Register a callback invoked when the call is closed (successfully or exceptionally). Provides the final kotlinx.rpc.grpc.GrpcStatus and the sent GrpcMetadata trailers.
Convenience for flow builders: proceeds with request and emits the resulting response elements into this FlowCollector. Useful inside flow {} blocks within interceptors.