buffer
Allow for a temporarily faster upstream events by buffering size
elements.
Signature
Source.buffer
Source.buffer
Flow.buffer
Flow.buffer
Description
Allow for a temporarily faster upstream events by buffering size
elements. When the buffer is full, a new element is handled according to the specified OverflowStrategy
:
backpressure
backpressure is applied upstreamdropHead
drops the oldest element in the buffer to make space for the new elementdropTail
drops the youngest element in the buffer to make space for the new elementdropBuffer
drops the entire buffer and buffers the new elementdropNew
drops the new elementfail
fails the flow with aBufferOverflowException
Reactive Streams semantics
emits when downstream stops backpressuring and there is a pending element in the buffer
backpressures when OverflowStrategy
is backpressure
and buffer is full
completes when upstream completes and buffered elements has been drained, or when OverflowStrategy
is fail
, the buffer is full and a new element arrives