Package io.servicetalk.http.api
Interface HttpLifecycleObserver.HttpRequestObserver
- All Known Subinterfaces:
GrpcLifecycleObserver.GrpcRequestObserver
- Enclosing interface:
- HttpLifecycleObserver
public static interface HttpLifecycleObserver.HttpRequestObserver
An observer interface that provides visibility into events associated with a single HTTP request.
The request is considered complete when one of the terminal events is invoked. It's guaranteed only one terminal event will be invoked per request.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Callback if the request is cancelled.void
Callback if the request completes successfully.void
onRequestData
(Buffer data) Callback when the request payload body data chunk was observed.default void
onRequestDataRequested
(long n) Callback when subscriber requestsn
items of the request payload body.void
onRequestError
(Throwable cause) Callback if the request fails with an error.void
onRequestTrailers
(HttpHeaders trailers) Callback when request trailers were observed.
-
Method Details
-
onRequestDataRequested
default void onRequestDataRequested(long n) Callback when subscriber requestsn
items of the request payload body.May be invoked multiple times. Helps to track when items are requested and when they are
delivered
.- Parameters:
n
- number of requested items
-
onRequestData
Callback when the request payload body data chunk was observed.May be invoked multiple times if the payload body is split into multiple chunks.
- Parameters:
data
- the request payload body data chunk
-
onRequestTrailers
Callback when request trailers were observed.- Parameters:
trailers
- trailers of the request
-
onRequestComplete
void onRequestComplete()Callback if the request completes successfully.This is one of the possible terminal events.
-
onRequestError
Callback if the request fails with an error.This is one of the possible terminal events.
- Parameters:
cause
-Throwable
that fails this request
-
onRequestCancel
void onRequestCancel()Callback if the request is cancelled.This is one of the possible terminal events. Cancellation is the best effort, more events may be signaled after cancel.
-