more docs for Sink.queue and actorRefWithAck (#25063)

This commit is contained in:
Konrad `ktoso` Malawski 2018-05-22 18:27:54 +09:00 committed by Arnout Engelen
parent 8f40dc7f03
commit de04758bb8
7 changed files with 118 additions and 9 deletions

View file

@ -1,4 +1,4 @@
# queue
# Source.queue
Materialize a `SourceQueue` onto which elements can be pushed for emitting from the source.
@ -19,6 +19,21 @@ a buffer, if elements are pushed onto the queue faster than the source is consum
a strategy specified by the user. Functionality for tracking when an element has been emitted is available through
`SourceQueue.offer`.
Using `Source.queue` you can push elements to the queue and they will be emitted to the stream if there is
demand from downstream, otherwise they will be buffered until request for demand is received. Elements in the buffer
will be discarded if downstream is terminated.
In combination with the queue, the @ref[`throttle`](./../Source-or-Flow/throttle.md) operator can be used to control the processing to a given limit, e.g. `5 elements` per `3 seconds`.
## Example
Scala
: @@snip [IntegrationDocSpec.scala]($code$/scala/docs/stream/IntegrationDocSpec.scala) { #source-queue }
Java
: @@snip [IntegrationDocTest.java]($code$/java/jdocs/stream/IntegrationDocTest.java) { #source-queue }
## Reactive Streams Semantics
@@@div { .callout }