Hi Richard,

Unfortunately there is no way currently to do dynamic balancing in a safe
way. As a simple attempt, one could create a groupBy that partitions the
work according to some randomly assigned worker id, and you can set that id
in an earlier stage dynamically, but the problem is that workers that are
no longer needed after a scale-down event will still be there. This might
or might not be a problem, but currently there is no perfect solution to
this. We are aware of this limitation and will add helpers to achieve what
you need, but we need to fix some APIs first for the next release.

-Endre

On Thu, Jan 21, 2016 at 9:29 AM, Richard Grossman <[email protected]>
wrote:

> Hi
>
> The question is not easy to explain I'll try to do my best
> My Flow include a mapConcat Part when I get 1 element and flatten in in
> multiple element.
> The number of element emitted is variable at this stage. thus 1 in -> n
> out .
> Now I would like to balance but on n element not on fixed element my code
> actually make this
>
> GraphDSL.create() { implicit builder =>
>  import akka.stream.scaladsl.GraphDSL.Implicits._
>
>  val dispatcher = builder.add(Balance[SubRequest](numEngine))
>  val allResponse = builder.add(Merge[SubResponse](numEngine))
>
>  for (i <- dispatcher.outArray.indices) {
>  dispatcher.out(i) ~> callHttp ~> allResponse.in(i)
>  }
>
>  FlowShape(dispatcher.in, allResponse.out)
> }
>
> As you can see I need to fix the number of engine when I materialize the
> graph.
> Is there any way to do it dynamically based on an element that can varying
> ?
> I don't know if it's a problem in my case I can fix a number and tell if I
> fix 10 as numEngine and actually I just pass 2 elements is there expensive
> overhead to do this ?
> Hope it's clear
>
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Akka Team
Typesafe - Reactive apps on the JVM
Blog: letitcrash.com
Twitter: @akkateam

-- 
>>>>>>>>>>      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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to