Class GrpcLifecycleObserverRequesterFilter
- All Implemented Interfaces:
HttpExecutionStrategyInfluencer,StreamingHttpClientFilterFactory,StreamingHttpConnectionFilterFactory,ExecutionStrategyInfluencer<HttpExecutionStrategy>
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 the first
client filter using
GrpcClientBuilder.initializeHttp(GrpcClientBuilder.HttpInitializer) to account for all work done by other
filters. It can be appended at another position, considering the following:
- After a tracing filter or any other filter that populates
request context,AsyncContext,MDC, or altersHttpRequestMetaDataif that information has to be available forGrpcLifecycleObserver.GrpcExchangeObserver. - After
RetryingHttpRequesterFilterif each retry attempt should be observed as an independentexchange. - As a
connection filterif no user-definedRetryingHttpRequesterFilteris appended manually but the default auto-retries should be observed as an independentexchange. - As the last
connection filterif only network interactions should be observed without accounting for work of any other filters. - After
TimeoutHttpRequesterFilter(orGrpcFilters.newGrpcDeadlineClientFilterFactory()) if the timeout event should be observed ascancellationinstead of anerror. - Before any filter that populates
response contextor altersHttpResponseMetaDataif that information has to be available forGrpcLifecycleObserver.GrpcExchangeObserver. - Before any filter that maps/translates
HttpResponseMetaDatainto anexceptionor throws an exception duringresponse payload body transformationif that exception has to be observed byGrpcLifecycleObserver.GrpcExchangeObserver. - Using
SingleAddressHttpClientBuilder.appendClientFilter(Predicate, StreamingHttpClientFilterFactory)orSingleAddressHttpClientBuilder.appendConnectionFilter(Predicate, StreamingHttpConnectionFilterFactory)if the observer should be applied conditionally.
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new instance. -
Method Summary
Modifier and TypeMethodDescriptionList<? extends GrpcLifecycleObserver>Returns theGrpcLifecycleObservers used by this filter.final HttpExecutionStrategyReturn anExecutionStrategythat describes the offloads required by the influencer.Methods inherited from class io.servicetalk.http.netty.HttpLifecycleObserverRequesterFilter
create, createMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.servicetalk.http.api.HttpExecutionStrategyInfluencer
influenceStrategy, requiredOffloads
-
Constructor Details
-
GrpcLifecycleObserverRequesterFilter
Create a new instance.- Parameters:
observer- Theobserverimplementation that consumes gRPC lifecycle events.
-
-
Method Details
-
lifecycleObservers
Returns theGrpcLifecycleObservers used by this filter.- Returns:
- a
ListofGrpcLifecycleObservers used by this filter
-
requiredOffloads
Description copied from interface:HttpExecutionStrategyInfluencerReturn anExecutionStrategythat describes the offloads required by the influencer.The provided default implementation requests offloading of all operations. Implementations that require no offloading should be careful to return
HttpExecutionStrategies.offloadNone()rather thanHttpExecutionStrategies.offloadNever(). Implementations should avoid returningHttpExecutionStrategies.defaultStrategy(), instead returning the strategy they require orHttpExecutionStrategies.offloadAll()if offloading for all paths is required (safe default).- Specified by:
requiredOffloadsin interfaceExecutionStrategyInfluencer<HttpExecutionStrategy>- Specified by:
requiredOffloadsin interfaceHttpExecutionStrategyInfluencer- Returns:
- the
ExecutionStrategyrequired by the influencer.
-