Akka 内置内存读取日志

问题描述

我试图在内存日志/快照中获取内置 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 (将#修改为@)

相关问答

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