Hello, You could have a look at the akka-http websocket example by Johannes Rudolph: https://github.com/jrudolph/akka-http-scala-js-websocket-chat
He doesn't combine two ActorRef sources, but he combines an ActorRef sink with an ActorRef source. The key is in the matValue function he uses in the chatFlow builder. As far as i can understand, this sends the materialized source ActorRef as a value through the stream: https://github.com/jrudolph/akka-http-scala-js-websocket-chat/blob/master/backend/src/main/scala/example/akkawschat/Chat.scala // Nic On Wednesday, May 6, 2015 at 4:50:37 PM UTC+3, akka-streams-beginner wrote: > > I posted this question to stackoverflow ( > http://stackoverflow.com/questions/30077766/how-to-attach-multiple-actors-as-sources-to-an-akka-stream), > > but then was pointed to this group, so I'll ask here: > > I am trying to build and run an akka stream flow (in Java DSL) with 2 > actors as sources, then a merge junction and then 1 sink: > > Source<Integer, ActorRef> src1 = Source.actorRef(100, > OverflowStrategy.backpressure()); > Source<Integer, ActorRef> src2 = Source.actorRef(100, > OverflowStrategy.backpressure()); > Sink<Integer, BoxedUnit> sink = > Flow.of(Integer.class).to(Sink.foreach(System.out::println)); > > RunnableFlow<BoxedUnit> closed = FlowGraph.factory().closed(sink, (b, > out) -> { > UniformFanInShape<Integer, Integer> merge = > b.graph(Merge.<Integer>create(2)); > b.from(src1).via(merge).to(out); > b.from(src2).to(merge); > }); > > closed.run(mat); > > My question is how do I obtain ActorRef references to the source actors in > order to send them messages? In case of 1 actor, I wouldn't be using graph > builder, and then the .run() or runWith() method would return the ActorRef > object. But what to do in case of many source actors? Is it even possible > to materialize such a flow? > > Thanks > -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: >>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user --- You received this message because you are subscribed to the Google Groups "Akka User List" group. To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+unsubscr...@googlegroups.com. To post to this group, send email to akka-user@googlegroups.com. Visit this group at http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.