I play with Akka threads and figured out most of the basics, but I don’t understand how to take the results Mergeand perform further operations (display, filtering, bending, etc.) in the subject.
I would like to modify the following code so that instead of linking the merge to the receiver, I could instead manipulate the data further.
implicit val materializer = FlowMaterializer()
val items_a = Source(List(10,20,30,40,50))
val items_b = Source(List(60,70,80,90,100))
val sink = ForeachSink(println)
val materialized = FlowGraph { implicit builder =>
import FlowGraphImplicits._
val merge = Merge[Int]("m1")
items_a ~> merge
items_b ~> merge ~> sink
}.run()
I assume that my main problem is that I cannot figure out how to create a component of a thread that has no source, and I cannot figure out how to perform a merge without using a special Merge and object ~>.
EDIT: This question and answer has been used and processed by Akka 0.11 threads.