Interface Request.Content.Consumer
-
- Enclosing interface:
- Request.Content
public static interface Request.Content.ConsumerA reactive model to consume request content, similar to
Flow.Subscriber.Callback methods
onContent(ByteBuffer, boolean, Callback)andonFailure(Throwable)are invoked in strict sequential order and never concurrently, although possibly by different threads.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidonContent(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 voidonFailure(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
callbackis associated with thebufferto signal when the content buffer has been consumed.Failing the
callbackdoes not have any effect on content production. To stop the content production, the consumer must callRequest.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 consumelast- whether it's the last contentcallback- 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
InputStreamto produce content.- Parameters:
failure- the reason of the failure
-
-