parent
48e4f11dfd
commit
3ae85e8cd0
8 changed files with 27 additions and 27 deletions
|
|
@ -749,8 +749,8 @@ public class IntegrationDocTest extends AbstractJavaTest {
|
|||
int bufferSize = 10;
|
||||
int elementsToProcess = 5;
|
||||
|
||||
SourceQueueWithComplete<Integer> sourceQueue =
|
||||
Source.<Integer>queue(bufferSize, OverflowStrategy.backpressure())
|
||||
BoundedSourceQueue<Integer> sourceQueue =
|
||||
Source.<Integer>queue(bufferSize)
|
||||
.throttle(elementsToProcess, Duration.ofSeconds(3))
|
||||
.map(x -> x * x)
|
||||
.to(Sink.foreach(x -> System.out.println("got: " + x)))
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import scala.concurrent.ExecutionContext
|
|||
import java.util.concurrent.atomic.AtomicInteger
|
||||
|
||||
import akka.stream.scaladsl.Flow
|
||||
import org.scalacheck.Gen.const
|
||||
|
||||
object IntegrationDocSpec {
|
||||
import TwitterStreamQuickstartDocSpec._
|
||||
|
|
@ -469,7 +470,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
|
|||
val elementsToProcess = 5
|
||||
|
||||
val queue = Source
|
||||
.queue[Int](bufferSize, OverflowStrategy.backpressure)
|
||||
.queue[Int](bufferSize)
|
||||
.throttle(elementsToProcess, 3.second)
|
||||
.map(x => x * x)
|
||||
.toMat(Sink.foreach(x => println(s"completed $x")))(Keep.left)
|
||||
|
|
@ -479,7 +480,7 @@ class IntegrationDocSpec extends AkkaSpec(IntegrationDocSpec.config) {
|
|||
|
||||
implicit val ec = system.dispatcher
|
||||
source
|
||||
.mapAsync(1)(x => {
|
||||
.map(x => {
|
||||
queue.offer(x).map {
|
||||
case QueueOfferResult.Enqueued => println(s"enqueued $x")
|
||||
case QueueOfferResult.Dropped => println(s"dropped $x")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue