Skip to content

Instantly share code, notes, and snippets.

@rocketpages
Created August 23, 2015 18:35
Show Gist options
  • Save rocketpages/c2b5148f06c91ea3aa74 to your computer and use it in GitHub Desktop.
Save rocketpages/c2b5148f06c91ea3aa74 to your computer and use it in GitHub Desktop.
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