Source.lazyFuture

Defers creation of a future of a single element source until there is demand.

Source operators

Signature

Source.lazyFutureSource.lazyFuture

Description

Invokes the user supplied factory when the first downstream demand arrives. When the returned future completes successfully the value is emitted downstream as a single stream element. If the future or the factory fails the stream is failed.

Note that asynchronous boundaries (and other operators) in the stream may do pre-fetching which counter acts the laziness and will trigger the factory immediately.

Reactive Streams semantics

emits when there is downstream demand and the element factory returned future has completed

completes after emitting the single element

Found an error in this documentation? The source code for this page can be found here. Please feel free to edit and contribute a pull request.