Open johanandren opened 2 years ago
I like the idea, but not sure it's very important. I don't think there is a strong requirement to "emit a Done for every element downstream". I think it's ok to group them together and emit one for the group if you are ok with the caveats explained in https://doc.akka.io/docs/akka-projection/current/flow.html
Ah, so just emitting the last ProjectionContext
together with the Done
that goes downstream would do the trick?
I think so ™️
The batching support is super nice, and as far as I understand it you can also achieve that with flows, as long as you emit a
Done
for every element downstream.Batching the offset update in that case is for every element in the batch, or if you use
.withSaveOffset(afterEnvelopes = 100, afterDuration = 500.millis)
possible to align the batch sizes when the rate is high, however matching theafterDuration
with theduration
in agroupedWithin
seems sketchy.Would be nice with a batching signature, something like
.groupedWithinFlow(Flow[Seq[Envelope], Done, _])
where the committing is done based on the batching of the envelopes into the flow or accepting aFlow[Envelope, Seq[Envelope], _]
where the user can batch anyway they want and get offsets commited based on those batches.