Created
August 23, 2015 18:35
-
-
Save rocketpages/c2b5148f06c91ea3aa74 to your computer and use it in GitHub Desktop.
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
val decider: Supervision.Decider = exc => exc match { | |
case _: ArithmeticException => Supervision.Resume | |
case _ => Supervision.Stop | |
} | |
// ActorFlowMaterializer takes the list of transformations comprising a akka.stream.scaladsl.Flow | |
// and materializes them in the form of org.reactivestreams.Processor | |
implicit val mat = ActorFlowMaterializer( | |
ActorFlowMaterializerSettings(system).withSupervisionStrategy(decider)) | |
val source = Source(0 to 5).map(100 / _) | |
val result = source.runWith(Sink.fold(0)(_ + _)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment