Interface HttpLifecycleObserver.HttpResponseObserver

All Known Subinterfaces:
GrpcLifecycleObserver.GrpcResponseObserver
Enclosing interface:
HttpLifecycleObserver

public static interface HttpLifecycleObserver.HttpResponseObserver
An observer interface that provides visibility into events associated with a single HTTP response.

The response is considered complete when one of the terminal events is invoked. It's guaranteed only one terminal event will be invoked per response.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Callback when the response is cancelled.
    void
    Callback when the response completes successfully.
    void
    Callback when the response payload body data chunk was observed.
    default void
    Callback when subscriber requests n items of the response payload body.
    void
    Callback when the response fails with an error.
    void
    Callback when response trailers were observed.
  • Method Details

    • onResponseDataRequested

      default void onResponseDataRequested(long n)
      Callback when subscriber requests n items of the response 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
    • onResponseData

      void onResponseData(Buffer data)
      Callback when the response payload body data chunk was observed.

      May be invoked multiple times if the payload body is split into multiple chunks.

      Parameters:
      data - the response payload body data chunk
    • onResponseTrailers

      void onResponseTrailers(HttpHeaders trailers)
      Callback when response trailers were observed.
      Parameters:
      trailers - trailers of the response
    • onResponseComplete

      void onResponseComplete()
      Callback when the response completes successfully.

      This is one of the possible terminal events.

    • onResponseError

      void onResponseError(Throwable cause)
      Callback when the response fails with an error.

      This is one of the possible terminal events.

      Parameters:
      cause - Throwable that terminated this response
    • onResponseCancel

      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.