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 altersHttpRequestMetaData
if that information has to be available forHttpLifecycleObserver.HttpExchangeObserver
. - After
RedirectingHttpRequesterFilter
if each redirect should be observed as an independentexchange
. - After
RetryingHttpRequesterFilter
if each retry attempt should be observed as an independentexchange
. - As a
connection filter
if no user-definedRetryingHttpRequesterFilter
is appended manually but the default auto-retries should be observed as an independentexchange
. - As the last
connection filter
if only network interactions should be observed without accounting for work of any other filters. - After
TimeoutHttpRequesterFilter
if the timeout event should be observed ascancellation
instead of anerror
. - Before any filter that populates
response context
or altersHttpResponseMetaData
if that information has to be available forHttpLifecycleObserver.HttpExchangeObserver
. - Before any filter that maps/translates
HttpResponseMetaData
into anexception
or throws an exception duringresponse payload body transformation
if 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
ConstructorDescriptionCreate a new instance. -
Method Summary
Modifier and TypeMethodDescriptioncreate
(FilterableStreamingHttpClient client) Creates aStreamingHttpClientFilter
using the providedStreamingHttpClientFilter
.create
(FilterableStreamingHttpConnection connection) Create aStreamingHttpConnectionFilter
using the providedFilterableStreamingHttpConnection
.final HttpExecutionStrategy
Return anExecutionStrategy
that describes the offloads required by the influencer.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.servicetalk.http.api.HttpExecutionStrategyInfluencer
influenceStrategy, requiredOffloads
-
Constructor Details
-
HttpLifecycleObserverRequesterFilter
Create a new instance.- Parameters:
observer
- Theobserver
implementation that consumes HTTP lifecycle events.
-
-
Method Details
-
create
Description copied from interface:StreamingHttpClientFilterFactory
Creates aStreamingHttpClientFilter
using the providedStreamingHttpClientFilter
.- Specified by:
create
in interfaceStreamingHttpClientFilterFactory
- Parameters:
client
-FilterableStreamingHttpClient
to filter- Returns:
StreamingHttpClientFilter
using the providedStreamingHttpClientFilter
.
-
create
Description copied from interface:StreamingHttpConnectionFilterFactory
Create aStreamingHttpConnectionFilter
using the providedFilterableStreamingHttpConnection
.- Specified by:
create
in interfaceStreamingHttpConnectionFilterFactory
- Parameters:
connection
-FilterableStreamingHttpConnection
to filter- Returns:
StreamingHttpConnectionFilter
using the providedFilterableStreamingHttpConnection
.
-
requiredOffloads
Description copied from interface:HttpExecutionStrategyInfluencer
Return anExecutionStrategy
that 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:
requiredOffloads
in interfaceExecutionStrategyInfluencer<HttpExecutionStrategy>
- Specified by:
requiredOffloads
in interfaceHttpExecutionStrategyInfluencer
- Returns:
- the
ExecutionStrategy
required by the influencer.
-