Source.future
Send the single value of the Future
when it completes and there is demand.
Signature
Description
Send the single value of the Future
when it completes and there is demand. If the future fails the stream is failed with that exception.
For the corresponding operator for the Java standard library CompletionStage
see completionStage.
Example
- Scala
-
source
import org.apache.pekko import pekko.actor.ActorSystem import pekko.stream.scaladsl._ import pekko.{ Done, NotUsed } import scala.concurrent.Future val source: Source[Int, NotUsed] = Source.future(Future.successful(10)) val sink: Sink[Int, Future[Done]] = Sink.foreach((i: Int) => println(i)) val done: Future[Done] = source.runWith(sink) // 10
Reactive Streams semantics
emits the future completes
completes after the future has completed
1.1.2+29-e21fa9eb*