Skip to content

Instantly share code, notes, and snippets.

@jeroenr
Created July 28, 2015 07:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeroenr/64ae1d45ff1846dab7b9 to your computer and use it in GitHub Desktop.
Save jeroenr/64ae1d45ff1846dab7b9 to your computer and use it in GitHub Desktop.
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