Skip to content

Instantly share code, notes, and snippets.

@LukeDefeo
Last active March 20, 2019 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LukeDefeo/7298b3a169773fa427c59dac328ba3cf to your computer and use it in GitHub Desktop.
Save LukeDefeo/7298b3a169773fa427c59dac328ba3cf to your computer and use it in GitHub Desktop.
val testSource = Source(1 until 50)
val processingFlow: Flow[Int, Int, NotUsed] = Flow[Int].mapAsyncUnordered(10)(x => Future {
println(s"Kicking off $x")
Thread.sleep(Random.nextInt(500))
x * 10
})
testSource.via(processingFlow).runWith(Sink.seq[Int])```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment