Forked from johanandren/ActorMaterializerSettingsApp.scala
Created
May 20, 2016 15:07
-
-
Save aruediger/f2c2c5e1ef728451fe1f6bc66b1a598d to your computer and use it in GitHub Desktop.
Does the stages inherit the materializer strategy?
This file contains hidden or 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
| package streams | |
| import akka.actor.ActorSystem | |
| import akka.stream.ActorAttributes.SupervisionStrategy | |
| import akka.stream.Supervision.Resume | |
| import akka.stream._ | |
| import akka.stream.scaladsl.Source | |
| import akka.stream.stage.{GraphStage, GraphStageLogic} | |
| object ActorMaterializerSettingsApp extends App { | |
| implicit val system = ActorSystem() | |
| implicit val mat = ActorMaterializer( | |
| ActorMaterializerSettings(system).withSupervisionStrategy(Supervision.restartingDecider: Supervision.Decider) | |
| ) | |
| class Test extends GraphStage[SourceShape[String]] { | |
| val out = Outlet[String]("ba") | |
| val shape = SourceShape.of(out) | |
| override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) { | |
| println(inheritedAttributes.get[SupervisionStrategy].get.decider eq Supervision.restartingDecider) | |
| } | |
| } | |
| Source.fromGraph(new Test).runForeach(println) | |
| system.terminate() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment