Interface HttpLifecycleObserver.HttpResponseObserver
- All Known Subinterfaces:
GrpcLifecycleObserver.GrpcResponseObserver
- Enclosing interface:
- HttpLifecycleObserver
The response is considered complete when one of the terminal events is invoked. It is guaranteed that only one terminal event will be invoked per response.
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidCallback when the response is cancelled.default voidCallback when the response completes successfully.default voidonResponseData(Buffer data) Callback when a response payload body data chunk was observed.default voidonResponseDataRequested(long n) Callback when the subscriber requestsnitems of the response payload body.default voidonResponseError(Throwable cause) Callback when the response fails with an error.default voidonResponseTrailers(HttpHeaders trailers) Callback when response trailers were observed.
-
Method Details
-
onResponseDataRequested
default void onResponseDataRequested(long n) Callback when the subscriber requestsnitems of the response payload body.May be invoked multiple times and concurrently with other callbacks on this observer. Therefore, it should have its own isolated state or should be synchronized if the state is shared with other callbacks. It can help to track when items are requested and when they are
delivered.- Parameters:
n- number of requested items
-
onResponseData
Callback when a response payload body data chunk was observed.May be invoked multiple times if the payload body is split into multiple chunks. All invocations are sequential between this and other callbacks except
onResponseDataRequested(long).- Parameters:
data- the response payload body data chunk
-
onResponseTrailers
Callback when response trailers were observed.May be invoked zero times (if no trailers are present in the response) or once after all
response data chunksare observed.- Parameters:
trailers- trailers of the response
-
onResponseComplete
default void onResponseComplete()Callback when the response completes successfully.This is one of the possible terminal events.
-
onResponseError
Callback when the response fails with an error.This is one of the possible terminal events.
- Parameters:
cause-Throwablethat terminated this response
-
onResponseCancel
default void onResponseCancel()Callback when the response is cancelled.This is one of the possible terminal events. Cancellation is the best effort, more events may be signaled after cancel.
-