I'm trying to create a generic load balancer and the code looks like this:

import akka.stream.scaladsl.{ Merge, Broadcast, FlowGraph }
import akka.stream.{ FlowShape, Graph }

object Balancer {
  def apply[A, B, C](nrOfWorkers: Int, workerGraph: Graph[FlowShape[A, B],
Unit]): Graph[FlowShape[A, B], Unit] =
    FlowGraph.partial(workerGraph) { implicit builder =>
      worker =>
        import FlowGraph.Implicits._

        val broadcast = builder.add(Broadcast[A](nrOfWorkers))
        val merge = builder.add(Merge[B](nrOfWorkers))

        for (i <- 0 until nrOfWorkers) {
          broadcast.out(i) ~> worker ~> merge.in(i)
        }

        FlowShape(broadcast.in, merge.out)
    }
}

With nrOfWorkers > 1, the creation of this partial graph get stuck after
the first iteration. Am I missing something? I was expecting this to create
as many workers as desired.

Regards,

Luis

-- 
>>>>>>>>>>      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.

Reply via email to