Stream: Sugar for Sink.ignore #27789, #24986

This commit is contained in:
Jacek Ewertowski 2020-03-23 13:05:25 +01:00 committed by GitHub
parent f8d7b0c94a
commit 2cccfa3c29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 57 additions and 6 deletions

View file

@ -929,6 +929,24 @@ final class Source[Out, Mat](delegate: scaladsl.Source[Out, Mat]) extends Graph[
def toMat[M, M2](sink: Graph[SinkShape[Out], M], combine: function.Function2[Mat, M, M2]): javadsl.RunnableGraph[M2] =
RunnableGraph.fromGraph(delegate.toMat(sink)(combinerToScala(combine)))
/**
* Connect this `Source` to the `Sink.ignore` and run it. Elements from the stream will be consumed and discarded.
*
* Note that the `ActorSystem` can be used as the `materializer` parameter to use the
* [[akka.stream.SystemMaterializer]] for running the stream.
*/
def run(materializer: Materializer): CompletionStage[Done] =
delegate.run()(materializer).toJava
/**
* Connect this `Source` to the `Sink.ignore` and run it. Elements from the stream will be consumed and discarded.
*
* Note that the `ActorSystem` can be used as the `systemProvider` parameter to use the
* [[akka.stream.SystemMaterializer]] for running the stream.
*/
def run(systemProvider: ClassicActorSystemProvider): CompletionStage[Done] =
delegate.run()(SystemMaterializer(systemProvider.classicSystem).materializer).toJava
/**
* Connect this `Source` to a `Sink` and run it. The returned value is the materialized value
* of the `Sink`, e.g. the `Publisher` of a `Sink.asPublisher`.