从已弃用的 PersistentView 更改为持久查询

Change to Persistent Query from deprecated PersistentView

我在用 Scala 编写的应用程序中使用 Akka Persistence,并将 LevelDB 作为存储插件。在查询端,当前的实现使用 PersistentView,它通过知道参与者的标识符从 PersistentActor 的日志中轮询消息。

现在我了解到 PersistentView 已被弃用,建议改用 Persistent Query。但是,我还没有找到任何关于如何使用 PersistentView 调整代码以支持首选持久性查询实现的任何详尽描述。

如有任何帮助,我们将不胜感激!

从2.4.x到2.5.x migration guide:

Removal of PersistentView

After being deprecated for a long time, and replaced by Persistence Query PersistentView has now been removed.

The corresponding query type is EventsByPersistenceId. There are several alternatives for connecting the Source to an actor corresponding to a previous PersistentView actor which are documented in Integration.

The consuming actor may be a plain Actor or an PersistentActor if it needs to store its own state (e.g. fromSequenceNr offset).

Please note that Persistence Query is not experimental/may-change anymore in Akka 2.5.0, so you can safely upgrade to it.