akka/akka-core
Add an optional buffer/parallelism parameter for actorRefWithAck
Aperta
#26.129 aperta il 17 dic 2018
1 - triagedhelp wantedt:stream
Metriche repository
- Star
- (13.277 stelle)
- Metriche merge PR
- (Merge medio 8g 19h) (10 PR mergiate in 30 g)
Descrizione
Flow.ask currently takes in a parallelism factor as an optional parameter. This allows messages to buffer in the destination ActorRef's mailbox. E.g.,
def myFlow(ref: ActorRef) = {
Source(1 to 100)
.ask[Response](4)(ref) //allows 4 messages to send before waiting for a Response
.to(Sink.ignore)
}
Sink.actorRefWithAck does not have any such functionality. Messages do not buffer.
def myAckFlow(ref: ActorRef) = {
Source(1 to 100)
//waits for a Response before sending the next element
.runWith(Sink.actorRefWithAck(ref,Init,Response,Completed, ex => Error(ex))
}
Johan and I discussed this briefly, and he felt like it would be a reasonable thing to add a parallelism (or buffer) parameter to actorRefWithAck.