|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface View
A view replicates the persistent message stream of a processor. Implementation classes receive the
message stream as Persistent
messages. These messages can be processed to update internal state
in order to maintain an (eventual consistent) view of the state of the corresponding processor. A
view can also run on a different node, provided that a replicated journal is used. Implementation
classes reference a processor by implementing persistenceId
.
Views can also store snapshots of internal state by calling Snapshotter.saveSnapshot(java.lang.Object)
. The snapshots of a view
are independent of those of the referenced processor. 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
- autoUpdate()
for turning automated updates on or off
- autoUpdateReplayMax()
for limiting the number of replayed messages per view update cycle
Views can also use channels to communicate with destinations in the same way as processors can do.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface akka.persistence.Recovery |
---|
Recovery.State |
Nested classes/interfaces inherited from interface akka.actor.Actor |
---|
Actor.emptyBehavior$ |
Method Summary | |
---|---|
java.lang.String |
_viewId()
|
boolean |
autoUpdate()
If true , this view automatically updates itself with an interval specified by autoUpdateInterval . |
scala.concurrent.duration.FiniteDuration |
autoUpdateInterval()
The interval for automated updates. |
long |
autoUpdateReplayMax()
The maximum number of messages to replay per update. |
Recovery.State |
idle()
When receiving an Update request, switches to replayStarted state and triggers
an incremental message replay. |
void |
onReplayComplete(boolean await)
Switches to idle state and schedules the next update if autoUpdate returns true . |
void |
onReplayFailure(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive,
boolean await,
java.lang.Throwable cause)
INTERNAL API. |
void |
onReplaySuccess(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive,
boolean await)
INTERNAL API. |
java.lang.String |
persistenceId()
Persistence id. |
void |
postStop()
User overridable callback. |
void |
preRestart(java.lang.Throwable reason,
scala.Option<java.lang.Object> message)
User overridable callback: '''By default it disposes of all children and then calls postStop() .''' |
void |
preStart()
Triggers an initial recovery, starting form a snapshot, if any, and replaying at most autoUpdateReplayMax
messages (following that snapshot). |
java.lang.Object |
replayStarted(boolean await)
INTERNAL API. |
scala.Option<Cancellable> |
schedule()
|
java.lang.String |
snapshotterId()
Returns viewId . |
java.lang.String |
viewId()
View id. |
akka.persistence.PersistenceSettings.view$ |
viewSettings()
|
Methods inherited from interface akka.persistence.Recovery |
---|
_currentPersistent, _currentState, _lastSequenceNr, _recoveryFailureCause, _recoveryFailureMessage, aroundReceive, currentPersistentMessage, extension, getCurrentPersistentMessage, journal, lastSequenceNr, prepareRestart, processorId, receiverStash, recoveryPending, recoveryStarted, replayFailed, runReceive, snapshotSequenceNr, updateLastSequenceNr, updateLastSequenceNr, withCurrentPersistent |
Methods inherited from interface akka.persistence.Snapshotter |
---|
deleteSnapshot, deleteSnapshots, loadSnapshot, saveSnapshot, snapshotStore |
Methods inherited from interface akka.actor.Actor |
---|
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, context, postRestart, receive, self, sender, supervisorStrategy, unhandled |
Methods inherited from interface akka.actor.StashSupport |
---|
actorCell, capacity, clearStash, context, enqueueFirst, mailbox, prepend, self, stash, theStash, unstash, unstashAll, unstashAll |
Methods inherited from interface akka.actor.StashFactory |
---|
createStash |
Method Detail |
---|
java.lang.Object replayStarted(boolean await)
Extends the replayStarted
state of Recovery
with logic to handle Update
requests
sent by users.
replayStarted
in interface Recovery
await
- (undocumented)
Recovery.State idle()
Update
request, switches to replayStarted
state and triggers
an incremental message replay. Invokes the actor's current behavior for any other
received message.
void onReplaySuccess(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive, boolean await)
onReplaySuccess
in interface Recovery
receive
- (undocumented)await
- (undocumented)void onReplayFailure(scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receive, boolean await, java.lang.Throwable cause)
onReplayFailure
in interface Recovery
receive
- (undocumented)await
- (undocumented)cause
- (undocumented)void onReplayComplete(boolean await)
idle
state and schedules the next update if autoUpdate
returns true
.
await
- (undocumented)java.lang.String _viewId()
akka.persistence.PersistenceSettings.view$ viewSettings()
scala.Option<Cancellable> schedule()
java.lang.String viewId()
java.lang.String snapshotterId()
viewId
.
snapshotterId
in interface Snapshotter
java.lang.String persistenceId()
persistenceId
in interface Recovery
boolean autoUpdate()
true
, this view automatically updates itself with an interval specified by autoUpdateInterval
.
If false
, applications must explicitly update this view by sending Update
requests. The default
value can be configured with the akka.persistence.view.auto-update
configuration key. This method
can be overridden by implementation classes to return non-default values.
scala.concurrent.duration.FiniteDuration autoUpdateInterval()
akka.persistence.view.auto-update-interval
configuration key. This method can be
overridden by implementation classes to return non-default values.
long autoUpdateReplayMax()
akka.persistence.view.auto-update-replay-max
configuration key. This method can be overridden by
implementation classes to return non-default values.
void preStart()
autoUpdateReplayMax
messages (following that snapshot).
preStart
in interface Actor
void preRestart(java.lang.Throwable reason, scala.Option<java.lang.Object> message)
Actor
postStop()
.'''
preRestart
in interface Actor
preRestart
in interface UnrestrictedStash
reason
- the Throwable that caused the restart to happenmessage
- optionally the current message the actor processed when failing, if applicable
Is called on a crashed Actor right BEFORE it is restarted to allow clean
up of resources before Actor is terminated.void postStop()
Actor
postStop
in interface Actor
postStop
in interface UnrestrictedStash
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |