Class HttpLifecycleObserverRequesterFilter
- All Implemented Interfaces:
HttpExecutionStrategyInfluencer,StreamingHttpClientFilterFactory,StreamingHttpConnectionFilterFactory,ExecutionStrategyInfluencer<HttpExecutionStrategy>
- Direct Known Subclasses:
GrpcLifecycleObserverRequesterFilter
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 on the
builder 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 forHttpLifecycleObserver.HttpExchangeObserver. - After
RedirectingHttpRequesterFilterif each redirect should be observed as an independentexchange. - 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
TimeoutHttpRequesterFilterif the timeout event should be observed ascancellationinstead of anerror. - Before any filter that populates
response contextor altersHttpResponseMetaDataif that information has to be available forHttpLifecycleObserver.HttpExchangeObserver. - Before any filter that maps/translates
HttpResponseMetaDatainto anexceptionor throws an exception duringresponse payload body transformationif that exception has to be observed byHttpLifecycleObserver.HttpExchangeObserver. - 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 TypeMethodDescriptioncreate(FilterableStreamingHttpClient client) Creates aStreamingHttpClientFilterusing the providedStreamingHttpClientFilter.create(FilterableStreamingHttpConnection connection) Create aStreamingHttpConnectionFilterusing the providedFilterableStreamingHttpConnection.List<? extends HttpLifecycleObserver>Returns theHttpLifecycleObservers used by this filter.final HttpExecutionStrategyReturn anExecutionStrategythat describes the offloads required by the influencer.Methods 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
-
HttpLifecycleObserverRequesterFilter
Create a new instance.- Parameters:
observer- Theobserverimplementation that consumes HTTP lifecycle events.
-
-
Method Details
-
create
Description copied from interface:StreamingHttpClientFilterFactoryCreates aStreamingHttpClientFilterusing the providedStreamingHttpClientFilter.- Specified by:
createin interfaceStreamingHttpClientFilterFactory- Parameters:
client-FilterableStreamingHttpClientto filter- Returns:
StreamingHttpClientFilterusing the providedStreamingHttpClientFilter.
-
create
Description copied from interface:StreamingHttpConnectionFilterFactoryCreate aStreamingHttpConnectionFilterusing the providedFilterableStreamingHttpConnection.- Specified by:
createin interfaceStreamingHttpConnectionFilterFactory- Parameters:
connection-FilterableStreamingHttpConnectionto filter- Returns:
StreamingHttpConnectionFilterusing the providedFilterableStreamingHttpConnection.
-
lifecycleObservers
Returns theHttpLifecycleObservers used by this filter.- Returns:
- a
ListofHttpLifecycleObservers 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.
-