=str #18556 add delay combinator

This commit is contained in:
Alexander Golubev 2015-11-21 13:48:10 -05:00
parent ce2d666c06
commit 270ef41359
7 changed files with 119 additions and 11 deletions

View file

@ -8,7 +8,9 @@ import java.io.{ OutputStream, InputStream, File }
import akka.actor.{ ActorRef, Cancellable, Props }
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.{ ConstantFun, StreamLayout }
import akka.stream.stage.Stage
import akka.util.ByteString
@ -707,6 +709,20 @@ final class Source[+Out, +Mat](delegate: scaladsl.Source[Out, Mat]) extends Grap
def groupedWithin(n: Int, d: FiniteDuration): javadsl.Source[java.util.List[Out @uncheckedVariance], Mat] =
new Source(delegate.groupedWithin(n, d).map(_.asJava)) // TODO optimize to one step
/**
* Shifts emissions in time by a specified amount
*
* '''Emits when''' upstream emitted and configured time elapsed
*
* '''Backpressures when''' downstream backpressures
*
* '''Completes when''' upstream completes
*
* '''Cancels when''' downstream completes
*/
def delay(of: FiniteDuration): javadsl.Source[Out, Mat] =
new Source(delegate.delay(of))
/**
* Discard the given number of elements at the beginning of the stream.
* No elements will be dropped if `n` is zero or negative.