Merge pull request #19498 from agolubev/agolubev-#18565-TerminationNotification-combinator

+str #18565 termination notification combinator
This commit is contained in:
drewhk 2016-01-25 10:52:48 +01:00
commit 41d8b1fadd
9 changed files with 173 additions and 3 deletions

View file

@ -12,7 +12,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
@ -1732,6 +1732,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.
*