Created
November 17, 2017 12:16
-
-
Save aludwiko/8a60bc77ff5c23d62ed4f53c80687422 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 nonLinearFlow = Flow.fromGraph(GraphDSL.create() { implicit builder => | |
import GraphDSL.Implicits._ | |
val dangerousFlow = Flow[Int].map { | |
case 5 => throw new RuntimeException(“BOOM!”) | |
case x => x | |
} | |
val safeFlow = Flow[Int] | |
val bcast = builder.add(Broadcast[Int](2)) | |
val zip = builder.add(Zip[Int, Int]) | |
bcast ~> dangerousFlow ~> zip.in0 | |
bcast ~> safeFlow ~> zip.in1 | |
FlowShape(bcast.in, zip.out) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment