问题描述
在编写我的测试套件时,我发现以下代码用于清理 https://github.com/dnvriend/akka-persistence-inmemory 提供的内存日志和快照存储,如下面的代码片段
import akka.actor.ActorSystem
import akka.persistence.inmemory.extension.{ InMemoryJournalStorage,InMemorySnapshotStorage,StorageExtension }
import akka.testkit.TestProbe
import org.scalatest.{ BeforeAndAfterEach,Suite }
trait InMemoryCleanup extends BeforeAndAfterEach { _: Suite =>
implicit def system: ActorSystem
override protected def beforeEach(): Unit = {
val tp = TestProbe()
tp.send(StorageExtension(system).journalStorage,InMemoryJournalStorage.ClearJournal)
tp.expectMsg(akka.actor.Status.Success(""))
tp.send(StorageExtension(system).snapshotStorage,InMemorySnapshotStorage.ClearSnapshots)
tp.expectMsg(akka.actor.Status.Success(""))
super.beforeEach()
}
}
在内存持久化配置中与内置的akka不兼容
persistence {
# inmem only for tests
journal.plugin = "akka.persistence.journal.inmem"
snapshot-store.plugin = "akka.persistence.snapshot-store.local"
snapshot-store.local.dir = "target/snapshot"
}
}
有没有办法在使用内置的 akka inmemory 日志时实现相同的日志/快照清除?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)