Source.unfoldResourceAsync
Wrap any resource that can be opened, queried for next element (in a blocking way) and closed using three distinct functions into a source.
Signature
def unfoldResourceAsync[T, S](create: () => Future[S],read: (S) => Future[Option[T]],close: (S) => Future[Done]): Source[T, NotUsed]
Description
Wrap any resource that can be opened, queried for next element (in a blocking way) and closed using three distinct functions into a source. Functions return Future
CompletionStage
to achieve asynchronous processing
emits when there is demand and Future
CompletionStage
from read function returns value
completes when Future
CompletionStage
from read function returns None