Forked from aludwiko/akka_streams_pitfalls_1.scala
Last active
December 5, 2017 19:18
-
-
Save timcharper/99f09fbe315cd960953ba98fe42120de to your computer and use it in GitHub Desktop.
Download this and run with ammonite
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env amm | |
import $ivy.`com.typesafe.akka::akka-stream:2.5.4` | |
import akka.Done | |
import akka.stream._ | |
import akka.stream.scaladsl._ | |
import scala.concurrent.Future | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.duration._ | |
implicit val as = akka.actor.ActorSystem() | |
implicit val m = ActorMaterializer() | |
val result: Future[Done] = Source(1 to 10) | |
.map(_ / 0) | |
.runWith(Sink.ignore) | |
result.onComplete { result => | |
println(s"Result was ${result}") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment