Conversation
|
@koola In the most basic implementation, it could look like this. e.SpawnFunc(func(*Context) {
defer func() {
// recover logic here
}()
})Of course, this is just one perspective |
This is still the case with this pr as any messages that are unprocessable are up to the user to handle. What this pr adds is a more fault tolerant solution to the default which is to silently drop messages and move on, the very definition of a one size fits all approach. One I wasn't happy with tbh. |
|
Also after thinking, your implementation adds more abstraction and further complexity. The actor already has an event stream that broadcasts events, which imo should include unprocessable messages so that there is only one place to subscribe and source of truth per actor. I think this opens up more options than the basic implementation given. |
This PR is a continuation of #181 . It introduces two new options
WithRetriesandWithMaxRetriesand aims to retry message failures on actor panics.The retry logic is as follows;
pid := e.SpawnFunc(func(c *Context) {}, "foo", WithRetries(2), WithMaxRetries(2), WithMaxRestarts(1))WithRetries(2).ActorUnprocessableMessageEventis broadcast to the eventstream containing the message and the message within the buffer is dropped.Using without retry;
pid := e.SpawnFunc(func(c *Context) {}, "foo", WithRetries(0), WithMaxRestarts(1))Included in this PR is a test that covers the full retry logic as well as amended tests.
All other tests pass.