Skip to content

Instantly share code, notes, and snippets.

@johanandren
Created May 20, 2016 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save johanandren/631c9fdf7933fed7fd2bd6fdd15e11a0 to your computer and use it in GitHub Desktop.
Save johanandren/631c9fdf7933fed7fd2bd6fdd15e11a0 to your computer and use it in GitHub Desktop.
Does the stages inherit the materializer strategy?
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] 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