2017-05-06 90 views
2

如何查询akka-persistence中的旧快照?Akka-Persistence:如何获取快照

我可以看到,SnapshotStore有一个LoadSnapshot消息是私人可用的,但无法用其他方式调用。

存在snapshotter界面 - >loadSnapshot

但是这给出了一个回调的演员,而不是我所需要的。

/** 
    * Instructs the snapshot store to load the specified snapshot and send it via an [[SnapshotOffer]] 
    * to the running [[PersistentActor]]. 
    */ 
    def loadSnapshot(persistenceId: String, criteria: SnapshotSelectionCriteria, toSequenceNr: Long) = 
    snapshotStore ! LoadSnapshot(persistenceId, criteria, toSequenceNr) 

我基本上需要一种方式ask快照存储给我快照,我需要。

有没有办法做到这一点?为什么它被明确隐私而不可回收?

回答

0

我不认为有明确要求某个快照的方法。

快照在SnapshotOffer消息的恢复过程中提供给持续的actor。默认情况下,为演员提供最新的快照,但可以通过覆盖recovery并提供自定义SnapshotSelectionCriteria来定制此最新快照。另见http://doc.akka.io/docs/akka/current/scala/persistence.html#Snapshots