PersistentView |
A view replicates the persistent message stream of a PersistentActor. Implementation classes receive the message stream directly from the Journal. These messages can be processed to update internal state in order to maintain an (eventual consistent) view of the state of the corresponding persistent actor. A persistent view can also run on a different node, provided that a replicated journal is used. Implementation classes refer to a persistent actors' message stream by implementing `persistenceId` with the corresponding (shared) identifier value. Views can also store snapshots of internal state by calling [[autoUpdate]]. The snapshots of a view are independent of those of the referenced persistent actor. During recovery, a saved snapshot is offered to the view with a SnapshotOffer message, followed by replayed messages, if any, that are younger than the snapshot. Default is to offer the latest saved snapshot. By default, a view automatically updates itself with an interval returned by `autoUpdateInterval`. This method can be overridden by implementation classes to define a view instance-specific update interval. The default update interval for all views of an actor system can be configured with the `akka.persistence.view.auto-update-interval` configuration key. Applications may trigger additional view updates by sending the view Update requests. See also methods |