I am trying to figure out how to perform the following stateful operation with akka-stream:
Let say i am emitting trough the stream a set of element e which contain an arbitrary set of element a.
I would like to rate limit the number of element e passed downstream, based on the overall amount of element a, that the number of element e received represent.
e.g. 4
Incoming stream
--> e1(a1e1)
--> e2(a1e2, a2e2)
--> e3(a1e3)
--> e4(a1e4, a2e4)
--> e5(a1e5, a2e5)
Would emit
group1 [e1, e2, e3]
group2 [e4, e5]
ultimately, this should be timed as in groupWithin. If a certain amount of time pass then just emit whatever you have.
Sounds like statefulmapContact might be the thing to look at but i am not sure.
If anyone expert in akka-stream could help here, that would be awesome.