Skip to content

Commit

Permalink
Reflect changes to StorageExtension in README.
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Maurer committed Sep 11, 2024
1 parent b1fa21f commit 9802644
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,21 @@ It is possible to manually clear the journal an snapshot storage, for example:

```scala
import akka.actor.ActorSystem
import akka.persistence.inmemory.extension.{ InMemoryJournalStorage, InMemorySnapshotStorage, StorageExtension }
import akka.persistence.inmemory.extension.{ InMemoryJournalStorage, InMemorySnapshotStorage, StorageExtensionProvider }
import akka.testkit.TestProbe
import org.scalatest.{ BeforeAndAfterEach, Suite }

trait InMemoryCleanup extends BeforeAndAfterEach { _: Suite =>

def config: Config
implicit def system: ActorSystem

override protected def beforeEach(): Unit = {
val tp = TestProbe()
tp.send(StorageExtension(system).journalStorage, InMemoryJournalStorage.ClearJournal)
val extension = StorageExtensionProvider(system)
tp.send(extension.journalStorage(config), InMemoryJournalStorage.ClearJournal)
tp.expectMsg(akka.actor.Status.Success(""))
tp.send(StorageExtension(system).snapshotStorage, InMemorySnapshotStorage.ClearSnapshots)
tp.send(extension.snapshotStorage(config), InMemorySnapshotStorage.ClearSnapshots)
tp.expectMsg(akka.actor.Status.Success(""))
super.beforeEach()
}
Expand Down

0 comments on commit 9802644

Please sign in to comment.