public static interface HttpLifecycleObserver.HttpExchangeObserver
An exchange is represented by a request and a response.
Both can be observed independently via their corresponding observers and may publish their events concurrently
with each other because connections are full-duplex. The final event for the
exchange is signaled only after both nested observers terminate. It guarantees visibility of both observers
internal states inside the final callback.
| Modifier and Type | Method and Description |
|---|---|
default void |
onConnectionSelected(ConnectionInfo info)
Callback when a connection is selected for this exchange execution.
|
default void |
onExchangeFinally()
Callback when the exchange completes.
|
default HttpLifecycleObserver.HttpRequestObserver |
onRequest(HttpRequestMetaData requestMetaData)
Callback when a request starts.
|
default HttpLifecycleObserver.HttpResponseObserver |
onResponse(HttpResponseMetaData responseMetaData)
Callback when a response meta-data was observed.
|
default void |
onResponseCancel()
Callback if the response meta-data was cancelled.
|
default void |
onResponseError(Throwable cause)
Callback if the response meta-data was not received due to an error.
|
default void onConnectionSelected(ConnectionInfo info)
info - ConnectionInfo of the selected connectiondefault HttpLifecycleObserver.HttpRequestObserver onRequest(HttpRequestMetaData requestMetaData)
requestMetaData - The corresponding HttpRequestMetaDataHttpLifecycleObserver.HttpRequestObserver that provides visibility into request eventsdefault HttpLifecycleObserver.HttpResponseObserver onResponse(HttpResponseMetaData responseMetaData)
Either this or onResponseError(Throwable) callback can be invoked, but not both.
responseMetaData - the corresponding HttpResponseMetaDataHttpLifecycleObserver.HttpResponseObserver that provides visibility into response eventsdefault void onResponseError(Throwable cause)
Either this or onResponse(HttpResponseMetaData) callback can be invoked, but not both.
cause - the cause of a response meta-data failuredefault void onResponseCancel()
Cancellation is the best effort, more events may be signaled after cancel.
default void onExchangeFinally()
This is the final callback that is invoked after HttpLifecycleObserver.HttpRequestObserver terminates and either
HttpLifecycleObserver.HttpResponseObserver terminates or onResponseError(Throwable)/onResponseCancel()
method is invoked. Inside this callback, users can safely consume the internal state of all other callbacks
without the need for additional synchronization.