asynkron / protoactor-go

Proto Actor - Ultra fast distributed actors for Go, C# and Java/Kotlin
http://proto.actor
Apache License 2.0
5.02k stars 521 forks source link

Batch message sent twice? #1016

Closed nightwolfz closed 8 months ago

nightwolfz commented 8 months ago

Maybe I don't understand something but it seems like we post the contents of the batch message, and then add the same batch message to the userMailbox again?

https://github.com/asynkron/protoactor-go/blob/2ecba7517929a27dc1ac0c44734b9c538b9044cb/actor/mailbox.go#L56

Shouldn't there be a return?

qazwsxedckll commented 8 months ago

Why both inner and outer message are pushed? In the TestPubSubWorksWithDefaultTopicRegistration case, 2000 PubSubAutoRespondBatch are sent but 2000 PubSubAutoRespondBatch and 2000 DataPublished are received.

the envelope can also implement other interfaces. e.g. auto-respond. which can be used to signal back that something has been completed. e.g. process each message individually from the batch then when the actor receives the envelope, which is also an auto-respond. it acks back to the sender automatically. so from the actors user-code, it just looks like normal messages coming in. the actor does not deal with a batch, nor does the user code have to handle the response

just quote Roger's response on slack.

nightwolfz commented 8 months ago

@qazwsxedckll Thanks for clearing that up :+1: