问题描述
我试图在内存日志/快照中获取内置 akka 持久性的读取日志。我的恢复和持久性工作正常,但是,我只是想为它编写一个测试套件,所以我需要能够直接从日志中读取值。这给了我一个我不明白的错误,也找不到任何有关的信息。我收到以下错误:
Unable to create read journal plugin instance for path [akka.persistence.journal.inmem],class [akka.persistence.journal.inmem.InmemJournal]!
java.lang.IllegalArgumentException: Unable to create read journal plugin instance for path [akka.persistence.journal.inmem],class [akka.persistence.journal.inmem.InmemJournal]!
我制作阅读日志的代码如下:
val readJournal =
PersistenceQuery(system).readJournalFor("akka.persistence.journal.inmem").asInstanceOf[ReadJournal
with EventsByPersistenceIdQuery]
// issue query to journal
val source: Source[EventEnvelope,NotUsed] =
readJournal.eventsByPersistenceId("replicationModel",Long.MaxValue)
// materialize stream,consuming events
source.runForeach { event =>
println("Event: " + event)
}
我也在application.conf文件中加入了这一段配置:
akka.persistence.journal.inmem {
# Class name of the plugin.
class = "akka.persistence.journal.inmem.InmemJournal"
# dispatcher for the plugin actor.
plugin-dispatcher = "akka.actor.default-dispatcher"
# Turn this on to test serialization of the events
test-serialization = off
}
# Local file system snapshot store plugin.
akka.persistence.snapshot-store.local {
# Class name of the plugin.
class = "akka.persistence.snapshot.local.LocalSnapshotStore"
# dispatcher for the plugin actor.
plugin-dispatcher = "akka.persistence.dispatchers.default-plugin-dispatcher"
# dispatcher for streaming snapshot IO.
stream-dispatcher = "akka.persistence.dispatchers.default-stream-dispatcher"
# Storage location of snapshot files.
dir = "snapshots"
# Number load attempts when recovering from the latest snapshot fails
# yet older snapshot files are available. Each recovery attempt will try
# to recover using an older than prevIoUsly Failed-on snapshot file
# (if any are present). If all attempts fail the recovery will fail and
# the persistent actor will be stopped.
max-load-attempts = 3
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)