Allow changing the recovery strategy in a typed persistence actor #25216 (#28932)

* Allow changing the recovery strategy in a typed persistence actor #25216

* scalafmt fix

* added mima exclusion

* added typed.Recovery allowing only default or disabled recovery strategy

* typed.Recovery takes SnapshotSelectionCriteria
deprecated withSnapshotSelectionCriteria

* updated docs
This commit is contained in:
Andreas Gabor 2020-04-28 08:18:50 +02:00 committed by GitHub
parent dc9f907caa
commit 30e79c6231
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 283 additions and 8 deletions

View file

@ -516,6 +516,20 @@ akka.persistence.journal.leveldb.replay-filter {
}
```
### Disable recovery
You can also completely disable the recovery of events and snapshots:
Scala
: @@snip [BasicPersistentBehaviorCompileOnly.scala](/akka-persistence-typed/src/test/scala/docs/akka/persistence/typed/BasicPersistentBehaviorCompileOnly.scala) { #recovery-disabled }
Java
: @@snip [BasicPersistentBehaviorTest.java](/akka-persistence-typed/src/test/java/jdocs/akka/persistence/typed/BasicPersistentBehaviorTest.java) { #recovery-disabled }
Please refer to @ref[snapshots](persistence-snapshot.md#snapshots) if you need to disable only the snapshot recovery, or you need to select specific snapshots.
In any case, the highest sequence number will always be recovered so you can keep persisting new events without corrupting your event log.
## Tagging
Persistence allows you to use event tags without using an @ref[`EventAdapter`](../persistence.md#event-adapters):