+str #19443 add support or Java Stream
This commit is contained in:
parent
b307a0ead7
commit
093d82ce00
18 changed files with 684 additions and 59 deletions
|
|
@ -12,7 +12,7 @@ import akka.stream.impl.StreamLayout
|
|||
import akka.stream.{ javadsl, scaladsl, _ }
|
||||
import org.reactivestreams.{ Publisher, Subscriber }
|
||||
import scala.compat.java8.OptionConverters._
|
||||
import scala.concurrent.ExecutionContext
|
||||
import scala.concurrent.{ Future, ExecutionContext }
|
||||
import scala.util.Try
|
||||
import java.util.concurrent.CompletionStage
|
||||
import scala.compat.java8.FutureConverters.FutureOps
|
||||
|
|
@ -229,8 +229,8 @@ object Sink {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates a `Sink` that is materialized as an [[akka.stream.SinkQueue]].
|
||||
* [[akka.stream.SinkQueue.pull]] method is pulling element from the stream and returns ``CompletionStage[Option[T]]``.
|
||||
* Creates a `Sink` that is materialized as an [[akka.stream.javadsl.SinkQueue]].
|
||||
* [[akka.stream.javadsl.SinkQueue.pull]] method is pulling element from the stream and returns ``CompletionStage[Option[T]]``.
|
||||
* `CompletionStage` completes when element is available.
|
||||
*
|
||||
* Before calling pull method second time you need to wait until previous CompletionStage completes.
|
||||
|
|
@ -240,12 +240,12 @@ object Sink {
|
|||
* upstream and then stop back pressure. You can configure size of input
|
||||
* buffer by using [[Sink.withAttributes]] method.
|
||||
*
|
||||
* For stream completion you need to pull all elements from [[akka.stream.SinkQueue]] including last None
|
||||
* For stream completion you need to pull all elements from [[akka.stream.javadsl.SinkQueue]] including last None
|
||||
* as completion marker
|
||||
*
|
||||
* @see [[akka.stream.SinkQueue]]
|
||||
* @see [[akka.stream.javadsl.SinkQueueWithCancel]]
|
||||
*/
|
||||
def queue[T](): Sink[T, SinkQueue[T]] =
|
||||
def queue[T](): Sink[T, SinkQueueWithCancel[T]] =
|
||||
new Sink(scaladsl.Sink.queue[T]().mapMaterializedValue(new SinkQueueAdapter(_)))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue