+str - Adds Sink.last and Sink.lastOption to mirror Sink.head and Sink.headOption
* Renames BlackholeSubscriber to SinkholeSunbscriber * Makes SinkholeSubscriber request Long.MaxValue * SinkholeSink seems like the best name ever
This commit is contained in:
parent
cb8d3c4609
commit
94fe1fb26d
13 changed files with 268 additions and 191 deletions
|
|
@ -113,6 +113,27 @@ object Sink {
|
|||
new Sink(scaladsl.Sink.headOption[In].mapMaterializedValue(
|
||||
_.map(akka.japi.Option.fromScalaOption)(ExecutionContexts.sameThreadExecutionContext)))
|
||||
|
||||
/**
|
||||
* A `Sink` that materializes into a `Future` of the last value received.
|
||||
* If the stream completes before signaling at least a single element, the Future will be failed with a [[NoSuchElementException]].
|
||||
* If the stream signals an error errors before signaling at least a single element, the Future will be failed with the streams exception.
|
||||
*
|
||||
* See also [[lastOption]].
|
||||
*/
|
||||
def last[In](): Sink[In, Future[In]] =
|
||||
new Sink(scaladsl.Sink.last[In])
|
||||
|
||||
/**
|
||||
* A `Sink` that materializes into a `Future` of the optional last value received.
|
||||
* If the stream completes before signaling at least a single element, the value of the Future will be an empty [[akka.japi.Option]].
|
||||
* If the stream signals an error errors before signaling at least a single element, the Future will be failed with the streams exception.
|
||||
*
|
||||
* See also [[head]].
|
||||
*/
|
||||
def lastOption[In](): Sink[In, Future[akka.japi.Option[In]]] =
|
||||
new Sink(scaladsl.Sink.lastOption[In].mapMaterializedValue(
|
||||
_.map(akka.japi.Option.fromScalaOption)(ExecutionContexts.sameThreadExecutionContext)))
|
||||
|
||||
/**
|
||||
* Sends the elements of the stream to the given `ActorRef`.
|
||||
* If the target actor terminates the stream will be canceled.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue