Class ResponsePublisher<ResponseT extends SdkResponse>

  • Type Parameters:
    ResponseT - Pojo response type.
    All Implemented Interfaces:
    org.reactivestreams.Publisher<ByteBuffer>, SdkPublisher<ByteBuffer>

    public final class ResponsePublisher<ResponseT extends SdkResponse>
    extends Object
    implements SdkPublisher<ByteBuffer>
    An SdkPublisher that publishes response body content and also contains a reference to the SdkResponse returned by the service.

    NOTE: You must subscribe to this publisher promptly to avoid automatic cancellation. The default timeout for subscribing is 60 seconds, which starts when the response body begins streaming. If subscribe(Subscriber) is not invoked before the timeout, the publisher will automatically cancel the underlying subscription to prevent resource leakage.

    The timeout can be customized by passing a Duration to the constructor, or disabled entirely by passing Duration.ZERO or a negative Duration.

    See Also:
    AsyncResponseTransformer.toPublisher()
    • Method Detail

      • response

        public ResponseT response()
        Returns:
        the unmarshalled response object from the service.
      • subscribe

        public void subscribe​(org.reactivestreams.Subscriber<? super ByteBuffer> subscriber)
        Specified by:
        subscribe in interface org.reactivestreams.Publisher<ResponseT extends SdkResponse>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • hasTimeoutTask

        public boolean hasTimeoutTask()
      • timeoutTaskDoneOrCancelled

        public boolean timeoutTaskDoneOrCancelled()