清除日志和快照条目不适用于内置的 akka 内存持久性

问题描述

在编写我的测试套件时,我发现以下代码用于清理 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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...