-
Notifications
You must be signed in to change notification settings - Fork 186
Description
The DurableStateBehavior documentation doesn't mention the RecoveryCompleted signal or show the correct import path. This leads to a subtle bug when users copy patterns from EventSourcedBehavior examples.
Problem
DurableStateBehavior and EventSourcedBehavior have different RecoveryCompleted signals in different packages:
| Behavior | Signal Import |
|---|---|
EventSourcedBehavior |
org.apache.pekko.persistence.typed.RecoveryCompleted |
DurableStateBehavior |
org.apache.pekko.persistence.typed.state.RecoveryCompleted |
This introduced a subtle bug in my code: when I used the wrong import, the pattern match failed silently. The signal handler never triggered, but:
- The code compiled without errors
- No runtime exception was thrown
- The signal was not matched
Questions
-
Is there a reason these are separate types? They seem to serve the same purpose.
-
Could they be unified? A single
RecoveryCompletedsignal would prevent this mistake. -
If they must remain separate, could the compiler warn? Perhaps a sealed trait or exhaustiveness check could help catch this at compile time.
-
At minimum, should the DurableStateBehavior docs mention this? The current docs don't show
receiveSignalusage or the correct import.
Environment
- Pekko version: 1.1.x
- Scala 3.3.x