Interface GrpcLifecycleObserver
- All Superinterfaces:
HttpLifecycleObserver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
To deliver events at accurate time, callbacks on this interface can be invoked from the IoExecutor.
Implementation of this observer must be non-blocking. If the
consumer of events may block (uses a blocking library or
logger configuration is not async), it must
offload publications to another Executor after capturing timing of events. If blocking code is
executed inside callbacks without offloading, it will negatively impact IoExecutor.
To install this observer for the server use
lifecycleObserver method or
appendNonOffloadingServiceFilter with
io.servicetalk.grpc.netty.GrpcLifecycleObserverServiceFilter which can be configured using
GrpcServerBuilder.initializeHttp(GrpcServerBuilder.HttpInitializer). For the client use either
appendClientFilter or
appendConnectionFilter with io.servicetalk.grpc.netty.GrpcLifecycleObserverRequesterFilter
which can be configured using GrpcClientBuilder.initializeHttp(GrpcClientBuilder.HttpInitializer).
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceAn observer interface that provides visibility into events associated with a single gRPC exchange.static interfaceAn observer interface that provides visibility into events associated with a single gRPC request.static interfaceAn observer interface that provides visibility into events associated with a single gRPC response.Nested classes/interfaces inherited from interface io.servicetalk.http.api.HttpLifecycleObserver
HttpLifecycleObserver.HttpExchangeObserver, HttpLifecycleObserver.HttpRequestObserver, HttpLifecycleObserver.HttpResponseObserver -
Method Summary
Modifier and TypeMethodDescriptionCallback when a new gRPC exchange starts.
-
Method Details
-
onNewExchange
GrpcLifecycleObserver.GrpcExchangeObserver onNewExchange()Callback when a new gRPC exchange starts.- Specified by:
onNewExchangein interfaceHttpLifecycleObserver- Returns:
- an
GrpcLifecycleObserver.GrpcExchangeObserverthat provides visibility into exchange events
-