Skip to content

Instantly share code, notes, and snippets.

@timcharper
Forked from aludwiko/akka_streams_pitfalls_1.scala
Last active December 5, 2017 19:18
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 timcharper/99f09fbe315cd960953ba98fe42120de to your computer and use it in GitHub Desktop.
Save timcharper/99f09fbe315cd960953ba98fe42120de to your computer and use it in GitHub Desktop.
Download this and run with ammonite
#!/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