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]
Hi Luis,
It should not stuck but throw, but this will not work:
> broadcast.out(i) ~> worker ~> merge.in(i)
>
You imported worker once, you cannot use it N times. You can either use
builder.add to add as many times as you need (the parametric import you
used only matters if you want t
Btw, have you looked at the actual cookbook sample?
http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0-M4/scala/stream-cookbook.html#Balancing_jobs_to_a_fixed_pool_of_workers
On Tue, Mar 3, 2015 at 2:56 PM, Endre Varga
wrote:
> Hi Luis,
>
> It should not stuck but throw, but this wil
Thank you Endre! Yes, I have seen that example. In my use case, workers are
also partial graphs and I will use builder.add to import the flow as many
times as I need and let you know if that did the trick. If I found any
other problem, I will simplify my use case so I can just use Flows.
2015-03-0
Adding as many worker instances as I need using builder.add works but one
caveat... this works:
object Balancer {
def apply[A, B, C](nrOfWorkers: Int, workerGraph: Graph[FlowShape[A, B],
Unit]): Graph[FlowShape[A, B], Unit] =
FlowGraph.partial() { implicit builder =>
import FlowGraph.I
Hi Luis,
On Tue, Mar 3, 2015 at 3:08 PM, Luis Ángel Vicente Sánchez <
langel.gro...@gmail.com> wrote:
> Thank you Endre! Yes, I have seen that example. In my use case, workers
> are also partial graphs
>
That does not matter. All Flows are partial graphs with exactly the shape
that you use Graph
Ok, then I will use the Flow API to simplify my code :) Thanks!
2015-03-03 14:31 GMT+00:00 Endre Varga :
> Hi Luis,
>
> On Tue, Mar 3, 2015 at 3:08 PM, Luis Ángel Vicente Sánchez <
> langel.gro...@gmail.com> wrote:
>
>> Thank you Endre! Yes, I have seen that example. In my use case, workers
>> ar