Interface HttpLifecycleObserver
- All Known Subinterfaces:
GrpcLifecycleObserver
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
In order 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 has to offload publications to another Executor
after capturing timing of events. If blocking code
is executed inside callbacks without offloading, it will negatively impact IoExecutor
and overall performance
of the application.
To install this observer for the server use HttpServerBuilder.lifecycleObserver(HttpLifecycleObserver)
, for
the client use SingleAddressHttpClientBuilder.appendClientFilter(StreamingHttpClientFilterFactory)
with
io.servicetalk.http.netty.HttpLifecycleObserverRequesterFilter
.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
An observer interface that provides visibility into events associated with a single HTTP exchange.static interface
An observer interface that provides visibility into events associated with a single HTTP request.static interface
An observer interface that provides visibility into events associated with a single HTTP response. -
Method Summary
Modifier and TypeMethodDescriptionCallback when a new HTTP exchange starts.
-
Method Details
-
onNewExchange
HttpLifecycleObserver.HttpExchangeObserver onNewExchange()Callback when a new HTTP exchange starts.Depending on the order in which the observer is applied, this callback can be invoked either for every retry attempt (if an observer is added after retrying filter) or only once per exchange.
- Returns:
- an
HttpLifecycleObserver.HttpExchangeObserver
that provides visibility into exchange events
-