+str #18565 termination notification combinator

This commit is contained in:
Alexander Golubev 2016-01-16 11:46:36 -05:00
parent 4dd6efc6a8
commit 98c72e7d13
9 changed files with 173 additions and 3 deletions

View file

@ -13,7 +13,7 @@ import akka.event.LoggingAdapter
import akka.japi.{ Pair, Util, function }
import akka.stream.Attributes._
import akka.stream._
import akka.stream.impl.fusing.Delay
import akka.stream.impl.fusing.{ GraphStages, Delay }
import akka.stream.impl.{ ConstantFun, StreamLayout }
import akka.stream.stage.Stage
import akka.util.ByteString
@ -1721,6 +1721,15 @@ final class Source[+Out, +Mat](delegate: scaladsl.Source[Out, Mat]) extends Grap
*/
def detach: javadsl.Source[Out, Mat] = new Source(delegate.detach)
/**
* Materializes to `Future[Done]` that completes on getting termination message.
* The Future completes with success when received complete message from upstream or cancel
* from downstream. It fails with the same error when received error message from
* downstream.
*/
def watchTermination[M]()(matF: function.Function2[Mat, Future[Done], M]): javadsl.Source[Out, M] =
new Source(delegate.watchTermination()(combinerToScala(matF)))
/**
* Delays the initial element by the specified duration.
*