Interface Request.Content.Consumer

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      void onContent​(java.nio.ByteBuffer buffer, boolean last, Callback callback)
      Callback method invoked by the producer when there is content available and there is demand for content.
      default void onFailure​(java.lang.Throwable failure)
      Callback method invoked by the producer when it failed to produce content.
    • Method Detail

      • onContent

        void onContent​(java.nio.ByteBuffer buffer,
                       boolean last,
                       Callback callback)

        Callback method invoked by the producer when there is content available and there is demand for content.

        The callback is associated with the buffer to signal when the content buffer has been consumed.

        Failing the callback does not have any effect on content production. To stop the content production, the consumer must call Request.Content.Subscription.fail(Throwable).

        In case an exception is thrown by this method, it is equivalent to a call to Request.Content.Subscription.fail(Throwable).

        Parameters:
        buffer - the content buffer to consume
        last - whether it's the last content
        callback - a callback to invoke when the content buffer is consumed
      • onFailure

        default void onFailure​(java.lang.Throwable failure)

        Callback method invoked by the producer when it failed to produce content.

        Typical failure: a producer getting an exception while reading from an InputStream to produce content.

        Parameters:
        failure - the reason of the failure