public final class GrpcLifecycleObserverServiceFilter
extends HttpLifecycleObserverServiceFilter
The result of the observed behavior will depend on the position of this filter in the execution chain.
This filter is recommended to be appended as one of the first filters using
HttpServerBuilder.appendNonOffloadingServiceFilter(StreamingHttpServiceFilterFactory) method via
GrpcServerBuilder.initializeHttp(GrpcServerBuilder.HttpInitializer) to account for all work done by other
filters and offloading of the requests processing. It can be appended at another position, considering the following:
request context, AsyncContext, MDC, or alters
HttpRequestMetaData if that information has to be available for GrpcLifecycleObserver.GrpcExchangeObserver.TimeoutHttpRequesterFilter if the timeout event should be observed as
cancellation instead of an
error.BasicAuthHttpServiceFilter, if only allowed requests
should be observed.BasicAuthHttpServiceFilter, if all incoming requests
have to be observed.response context or alters
HttpResponseMetaData if that information has to be available for GrpcLifecycleObserver.GrpcExchangeObserver.HttpResponseMetaData into an exception or
throws an exception during response payload body
transformation if that exception has to be observed by GrpcLifecycleObserver.GrpcExchangeObserver.exception into a valid response, like
GrpcExceptionMapperServiceFilter, if the GrpcLifecycleObserver.GrpcExchangeObserver should see what GrpcStatus
is returned to the client.HttpServerBuilder.appendServiceFilter(StreamingHttpServiceFilterFactory) if an exchange
should be observed after it's offloaded from an IoExecutor (if offloading is enabled).HttpServerBuilder.appendNonOffloadingServiceFilter(Predicate, StreamingHttpServiceFilterFactory) or
HttpServerBuilder.appendServiceFilter(Predicate, StreamingHttpServiceFilterFactory) if the observer
should be applied conditionally.HttpServerBuilder.appendServiceFilter(StreamingHttpServiceFilterFactory) if only service
business logic should be observed without accounting for work of any other filters.GrpcLifecycleObserver is to use
GrpcServerBuilder.lifecycleObserver(GrpcLifecycleObserver).GrpcServerBuilder.lifecycleObserver(GrpcLifecycleObserver)| Constructor and Description |
|---|
GrpcLifecycleObserverServiceFilter(GrpcLifecycleObserver observer)
Create a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
HttpExecutionStrategy |
requiredOffloads() |