Akka Streams `GroupBy` power change at the end of SubFlow?

When using groupBy in the definition of a stream stream with some maximum capacity n :

 source.groupBy(Int.MaxValue, _.key).to(Sink.actorRef) 

If I plug in substreams that lead to the claim that the Actor receiver deliberately causes interrupts to end on some message, will it free up the groupBy capacity? Will it go from n to n-1 back to n if the substream ends with the receiver? Is this a viable way to create a dynamic graph?

+5
source share
1 answer

Regarding how groupBy works: yes , maxSubstreams capacity is dynamic, i.e. represents the maximum number of active substreams .

The groupBy stage stores the link to each substream in its internal state, and this is deleted whenever this particular substream terminates.

As for your specific example, I don’t think there is a way to make sure that "the subflow ended in a sink." This is because when using to(Sink.actorRef) after a groupBy all threads will be served by one separate actor.

+1
source

Source: https://habr.com/ru/post/1267353/


All Articles