Package io.servicetalk.http.api
Interface HttpLifecycleObserver.HttpExchangeObserver
- All Known Subinterfaces:
GrpcLifecycleObserver.GrpcExchangeObserver
- Enclosing interface:
- HttpLifecycleObserver
public static interface HttpLifecycleObserver.HttpExchangeObserver
An observer interface that provides visibility into events associated with a single HTTP exchange.
An exchange is represented by a request
and a response
.
Both can be observed independently and may publish their events concurrently because connections are full-duplex.
The terminal event
for the exchange is signaled only when nested observers signal
terminal events. Cancellation is the best effort, more events may be signaled after cancel.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Callback when a connection is selected for this exchange execution.void
Callback when the exchange completes.onRequest
(HttpRequestMetaData requestMetaData) Callback when a request starts.onResponse
(HttpResponseMetaData responseMetaData) Callback when a response meta-data was observed.void
Callback if the response meta-data was cancelled.void
onResponseError
(Throwable cause) Callback if the response meta-data was not received due to an error.
-
Method Details
-
onConnectionSelected
Callback when a connection is selected for this exchange execution.This callback may be invoked for every retry attempt.
- Parameters:
info
-ConnectionInfo
of the selected connection
-
onRequest
Callback when a request starts.- Parameters:
requestMetaData
- The correspondingHttpRequestMetaData
- Returns:
- an
HttpLifecycleObserver.HttpRequestObserver
that provides visibility into request events
-
onResponse
Callback when a response meta-data was observed.- Parameters:
responseMetaData
- the correspondingHttpResponseMetaData
- Returns:
- an
HttpLifecycleObserver.HttpResponseObserver
that provides visibility into response events
-
onResponseError
Callback if the response meta-data was not received due to an error.- Parameters:
cause
- the cause of a response meta-data failure
-
onResponseCancel
void onResponseCancel()Callback if the response meta-data was cancelled.Cancellation is the best effort, more events may be signaled after cancel.
-
onExchangeFinally
void onExchangeFinally()Callback when the exchange completes.This is the final callback that is invoked after
HttpLifecycleObserver.HttpRequestObserver
terminate and eitherHttpLifecycleObserver.HttpResponseObserver
terminate oronResponseError(Throwable)
/onResponseCancel()
method is invoked.
-