Flow.lazyInitAsync

Creates a real Flow upon receiving the first element by calling relevant flowFactory given as an argument.

Simple operators

Signature

def lazyInitAsync[I, O, M](flowFactory: () ⇒ Future[Flow[I, O, M]]): Flow[I, O, Future[Option[M]]]

Description

Creates a real Flow upon receiving the first element by calling relevant flowFactory given as an argument. Internal Flow will not be created if there are no elements, because of completion or error. The materialized value of the Flow will be the materialized value of the created internal flow.

The materialized value of the Flow is a Future[Option[M]]CompletionStage<Optional<M>> that is completed with Some(mat)Optional.of(mat) when the internal flow gets materialized or with None an empty optional when there where no elements. If the flow materialization (including the call of the flowFactory) fails then the future is completed with a failure.

Adheres to the ActorAttributes.SupervisionStrategy attribute.

emits when the internal flow is successfully created and it emits

backpressures when the internal flow is successfully created and it backpressures

completes when upstream completes and all elements have been emitted from the internal flow

completes when upstream completes and all futures have been completed and all elements have been emitted

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.