Source.unfoldAsync

Just like unfold but the fold function returns a Future CompletionStage.

Source operators

Signature

def unfoldAsync[S, E](s: S)(f: S ⇒ Future[Option[(S, E)]]): Source[E, NotUsed]

Description

Just like unfold but the fold function returns a Future CompletionStage which will cause the source to complete or emit when it completes.

Can be used to implement many stateful sources without having to touch the more low level GraphStage API.

emits when there is demand and unfold state returned future completes with some value

completes when the future CompletionStage returned by the unfold function completes with an empty value

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.