I can't tell if I'm doing something wrong in this code:
implicit val as = ActorSystem()
implicit val mat = ActorMaterializer()
val future = Source.fromIterator(() => new Iterator[Int] {
var i = 0
override def hasNext: Boolean = true
override def next(): Int = {
println(s"Waiting $i seconds")
scala.concurrent.blocking {
Thread.sleep(i * 1000)
}
i = i + 1
i
}
}).groupedWithin(20, 2.seconds).runForeach(println)
Await.ready(future, 10.seconds)
It seems to me that at least something should be printed. But the output
invariably is:
Waiting 0 seconds
Waiting 1 seconds
Waiting 2 seconds
Waiting 3 seconds
Waiting 4 seconds
Waiting 5 seconds
java.util.concurrent.TimeoutException: Futures timed out after [10000
milliseconds]
I tried to follow the code of GroupedWithin and it seems that the timer
works as expected but then when the AsyncCall gets called nothing happens
(from `GraphStage`):
interpreter.onAsyncInput(GraphStageLogic.this, event, handler.asInstanceOf[Any
⇒ Unit])
Bruno
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.