Created
July 28, 2015 07:47
-
-
Save jeroenr/64ae1d45ff1846dab7b9 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 src = Source.actorRef[ByteString](1000, OverflowStrategy.dropHead) | |
FlowGraph.closed(src) { implicit builder => | |
byteStringSource => | |
import FlowGraph.Implicits._ | |
// for junctions / fan-in / fan-out shapes we need to builder.add explicitly | |
val broadcaster = builder.add(Broadcast[String](2)) | |
// for Flows builder.add is implicit, if I'm not mistaking | |
byteStringSource.outlet ~> Flow[ByteString].map(_.utf8String) ~> broadcaster.in | |
broadcaster.out(0) ~> Sink.ignore | |
broadcaster.out(1) ~> Sink.ignore | |
}.run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment