How to control or turn off recovery in EventSourcedBehavior

I was migrating a classic persistent Actor (extending AbstractPersistentActor) to the new typed approach by extending EventSourcedBehavior. I have some situations where I want to restart an actor and start fresh (without recovering it). In the classic approach I could control that behavior, by overriding the recovery method, e.g.

@Override
public Recovery recovery() {
   // Here I could make some decisions on whether to recover and return the right Recovery object
   return Recovery.none();
}

But I could not find anything like that in EventSourcedBehavior. How would I skip recovery here?

That feature is in progress in https://github.com/akka/akka/pull/28932

1 Like