I'm new to akka-stream, so want to ask how to reproduce behavior presented in this article http://doc.akka.io/docs/akka-stream-and-http-experimental/2.0.2/scala/stream-rate.html
For given code
Source(1 to 3)
.map { i => println(s"A: $i"); i }
.map { i => println(s"B: $i"); i }
.map { i => println(s"C: $i"); i }
.runWith(Sink.ignore)
Get such similar
A: 1
A: 2
B: 1
A: 3
B: 2
C: 1
B: 3
C: 2
C: 3
I've tried add some random Thread.sleep
,
create a stream from an infinite iterator.
But Akka accordingly to the debug output always uses the same thread for processing.
So the question is: How to reproduce async behavior (every stage should run in an async way) using akka-stream?