Akka's `BackoffSupervisor` ships with two separate factories:
- `Backoff.onFailure(...)` — respawn only when the child crashes (uncaught exception). Clean stops are propagated up.
- `Backoff.onStop(...)` — respawn on any termination (crash OR clean stop). Useful when the child stops itself periodically (e.g. transient connection actor).
Our v1 (#48) only implements the unified `onTerminated` shape (every termination respawns). The v1 JSDoc notes this — a child that wants "stop = done" semantics has to be wrapped specially.
Scope:
- New option: `triggerOn: 'failure' | 'stop' | 'any'`. Default `'any'` (current behaviour, backwards-compatible).
- The supervisor's child-supervisor strategy needs to differentiate:
- `'failure'`: on failure, the strategy stops the child + we respawn. On clean child-stop, the supervisor itself stops.
- `'stop'`: on any termination respawn (current behaviour, but make it explicit for documentation).
- `'any'`: alias for current behaviour.
Tests:
- A child that calls `stopSelf()` after handling N messages — verify it's respawned in `'any'` mode but not in `'failure'` mode.
- A child that throws — verify it's respawned in both `'failure'` and `'any'` mode.
Estimate: 1 day.
Akka's `BackoffSupervisor` ships with two separate factories:
Our v1 (#48) only implements the unified `onTerminated` shape (every termination respawns). The v1 JSDoc notes this — a child that wants "stop = done" semantics has to be wrapped specially.
Scope:
Tests:
Estimate: 1 day.