Package io.servicetalk.grpc.api
Interface GrpcServiceContext
- All Superinterfaces:
AsyncCloseable
,ConnectionContext
,ConnectionInfo
,GrpcMetadata
,ListenableAsyncCloseable
A gRPC service context.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.servicetalk.transport.api.ConnectionInfo
ConnectionInfo.Protocol
-
Method Summary
Modifier and TypeMethodDescriptionGet theExecutionContext
for thisConnectionInfo
.protocol()
Get theConnectionInfo.Protocol
for thisConnectionInfo
.default ContextMap
A response context associated with thisGrpcMetadata
that translates intoHttpMetaData.context()
.Deprecated.Methods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefully
Methods inherited from interface io.servicetalk.transport.api.ConnectionContext
parent
Methods inherited from interface io.servicetalk.transport.api.ConnectionInfo
localAddress, remoteAddress, socketOption, sslConfig, sslSession
Methods inherited from interface io.servicetalk.grpc.api.GrpcMetadata
path, requestContext
Methods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosing
-
Method Details
-
executionContext
GrpcExecutionContext executionContext()Description copied from interface:ConnectionInfo
Get theExecutionContext
for thisConnectionInfo
.The
ExecutionContext.ioExecutor()
will represent the thread responsible for IO for thisConnectionInfo
. Note that this maybe different that what was used to create this object because at this time a specificIoExecutor
has been selected.- Specified by:
executionContext
in interfaceConnectionInfo
- Returns:
- the
ExecutionContext
for thisConnectionInfo
.
-
protocol
GrpcServiceContext.GrpcProtocol protocol()Description copied from interface:ConnectionInfo
Get theConnectionInfo.Protocol
for thisConnectionInfo
.- Specified by:
protocol
in interfaceConnectionInfo
- Returns:
- the
ConnectionInfo.Protocol
for thisConnectionInfo
.
-
supportedMessageCodings
Deprecated.Will be removed along withContentCodec
.TheContentCodec
codings available for this gRPC call.- Returns:
- the
ContentCodec
codings available for this gRPC call.
-
responseContext
A response context associated with thisGrpcMetadata
that translates intoHttpMetaData.context()
.Context can be used to associate a state with a response without serializing its state on the wire or transmit a state between HTTP and gRPC layers.
Notes:
- For asynchronous endpoints that operate with a
Publisher
either for reading or writing data back, only modifications to theresponseContext()
made before the endpoint method returns are visible for HTTPheaders
. Any other modifications made from inside the asynchronous chain of operators or from inside thePublisher.defer(Supplier)
operator will be visible only for HTTPtrailers
. - For synchronous endpoints that operate with
BlockingStreamingGrpcServerResponse
, only modifications to theresponseContext()
made before invocation ofBlockingStreamingGrpcServerResponse.sendMetaData()
method are visible for HTTPheaders
. Any other modifications made later (while operating withGrpcPayloadWriter
) will be visible only for HTTPtrailers
.
- Specified by:
responseContext
in interfaceGrpcMetadata
- Returns:
- a response context associated with this
GrpcMetadata
that translates intoHttpMetaData.context()
.
- For asynchronous endpoints that operate with a
-
ContentCodec
.