|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectakka.actor.UntypedActor
akka.persistence.UntypedPersistentActor
public abstract class UntypedPersistentActor
Java API: an persistent actor - can be used to implement command or event sourcing.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface akka.persistence.Eventsourced |
|---|
Eventsourced.PendingHandlerInvocation |
| Nested classes/interfaces inherited from interface akka.persistence.Recovery |
|---|
Recovery.State |
| Nested classes/interfaces inherited from interface akka.actor.Actor |
|---|
Actor.emptyBehavior$ |
| Constructor Summary | |
|---|---|
UntypedPersistentActor()
|
|
| Method Summary | ||
|---|---|---|
|
defer(A event,
Procedure<A> handler)
Defer the handler execution until all pending handlers have been executed. |
|
|
defer(java.lang.Iterable<A> events,
Procedure<A> handler)
Defer the handler execution until all pending handlers have been executed. |
|
void |
onReceive(java.lang.Object message)
To be implemented by concrete UntypedActor, this defines the behavior of the UntypedActor. |
|
abstract void |
onReceiveCommand(java.lang.Object msg)
Java API: command handler. |
|
abstract void |
onReceiveRecover(java.lang.Object msg)
Java API: recovery handler that receives persisted events during recovery. |
|
|
persist(A event,
Procedure<A> handler)
Java API: asynchronously persists event. |
|
|
persist(java.lang.Iterable<A> events,
Procedure<A> handler)
Java API: asynchronously persists events in specified order. |
|
|
persistAsync(A event,
Procedure<A> handler)
JAVA API: asynchronously persists event. |
|
|
persistAsync(java.lang.Iterable<A> events,
scala.Function1<A,scala.runtime.BoxedUnit> handler)
JAVA API: asynchronously persists events in specified order. |
|
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receiveCommand()
|
|
scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> |
receiveRecover()
|
|
| Methods inherited from class akka.actor.UntypedActor |
|---|
getContext, getSelf, getSender, postRestart, postStop, preRestart, preStart, receive, supervisorStrategy, unhandled |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface akka.persistence.Eventsourced |
|---|
aroundPreRestart, aroundReceive, currentState, defer, defer, flushBatch, initialBehavior, pendingInvocations, pendingStashingPersistInvocations, persist, persist, persistAsync, persistAsync, persistingEvents, postStop, preRestart, processingCommands, processorStash, recovering, recoveryBehavior, resequenceableEventBatch, unstashAll, useProcessorBatching |
| Methods inherited from interface akka.persistence.ProcessorImpl |
|---|
_persistenceId, aroundPostStop, aroundPreStart, deleteMessage, deleteMessage, deleteMessages, deleteMessages, flushJournalBatch, initializing, instanceId, nextSequenceNr, onRecoveryCompleted, onRecoveryFailure, onReplayFailure, onReplaySuccess, preRestartDefault, preStart, processing, processorBatch, processorId, recoveryFinished, recoveryRunning, sequenceNr, snapshotterId, unhandled, unstashFilterPredicate |
| Methods inherited from interface akka.persistence.Recovery |
|---|
_currentPersistent, _currentState, _lastSequenceNr, _recoveryFailureCause, _recoveryFailureMessage, currentPersistentMessage, extension, getCurrentPersistentMessage, journal, lastSequenceNr, persistenceId, prepareRestart, receiverStash, recoveryPending, recoveryStarted, replayFailed, replayStarted, 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, context, postRestart, receive, self, sender, supervisorStrategy |
| Methods inherited from interface akka.actor.StashSupport |
|---|
actorCell, capacity, clearStash, context, enqueueFirst, mailbox, prepend, self, stash, theStash, unstash, unstashAll |
| Methods inherited from interface akka.actor.StashFactory |
|---|
createStash |
| Constructor Detail |
|---|
public UntypedPersistentActor()
| Method Detail |
|---|
public final void onReceive(java.lang.Object message)
UntypedActor
onReceive in class UntypedActormessage - (undocumented)public final scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receiveRecover()
receiveRecover in interface Eventsourcedpublic final scala.PartialFunction<java.lang.Object,scala.runtime.BoxedUnit> receiveCommand()
receiveCommand in interface Eventsourced
public final <A> void persist(A event,
Procedure<A> handler)
event. On successful persistence, handler is called with the
persisted event. It is guaranteed that no new commands will be received by a persistent actor
between a call to persist and the execution of its handler. This also holds for
multiple persist calls per received command. Internally, this is achieved by stashing new
commands and unstashing them when the event has been persisted and handled. The stash used
for that is an internal stash which doesn't interfere with the inherited user stash.
An event handler may close over persistent actor state and modify it. The getSender() of a persisted
event is the sender of the corresponding command. This means that one can reply to a command
sender within an event handler.
Within an event handler, applications usually update persistent actor state using persisted event data, notify listeners and reply to command senders.
If persistence of an event fails, the persistent actor will be stopped. This can be customized by
handling PersistenceFailure in onReceiveCommand.
event - event to be persisted.handler - handler for each persisted event
public final <A> void persist(java.lang.Iterable<A> events,
Procedure<A> handler)
events in specified order. This is equivalent to calling
persist[A](event: A, handler: Procedure[A]) multiple times with the same handler,
except that events are persisted atomically with this method.
events - events to be persisted.handler - handler for each persisted events
public final <A> void persistAsync(A event,
Procedure<A> handler)
event. On successful persistence, handler is called with the
persisted event.
Unlike persist the persistent actor will continue to receive incomming commands between the
call to persist and executing it's handler. This asynchronous, non-stashing, version of
of persist should be used when you favor throughput over the "command-2 only processed after
command-1 effects' have been applied" guarantee, which is provided by the plain persist method.
An event handler may close over persistent actor state and modify it. The sender of a persisted
event is the sender of the corresponding command. This means that one can reply to a command
sender within an event handler.
If persistence of an event fails, the persistent actor will be stopped. This can be customized by
handling PersistenceFailure in receiveCommand.
event - event to be persistedhandler - handler for each persisted event
public final <A> void persistAsync(java.lang.Iterable<A> events,
scala.Function1<A,scala.runtime.BoxedUnit> handler)
events in specified order. This is equivalent to calling
persistAsync[A](event: A)(handler: A => Unit) multiple times with the same handler,
except that events are persisted atomically with this method.
events - events to be persistedhandler - handler for each persisted events
public final <A> void defer(A event,
Procedure<A> handler)
persistAsync calls. That is, if persistAsync was invoked before defer,
the corresponding handlers will be invoked in the same order as they were registered in.
This call will NOT result in event being persisted, please use persist or persistAsync,
if the given event should possible to replay.
If there are no pending persist handler calls, the handler will be called immediatly.
In the event of persistence failures (indicated by PersistenceFailure messages being sent to the
PersistentActor, you can handle these messages, which in turn will enable the deferred handlers to run afterwards.
If persistence failure messages are left unhandled, the default behavior is to stop the Actor, thus the handlers
will not be run.
event - event to be handled in the future, when preceeding persist operations have been processeshandler - handler for the given event
public final <A> void defer(java.lang.Iterable<A> events,
Procedure<A> handler)
persistAsync calls. That is, if persistAsync was invoked before defer,
the corresponding handlers will be invoked in the same order as they were registered in.
This call will NOT result in event being persisted, please use persist or persistAsync,
if the given event should possible to replay.
If there are no pending persist handler calls, the handler will be called immediatly.
In the event of persistence failures (indicated by PersistenceFailure messages being sent to the
PersistentActor, you can handle these messages, which in turn will enable the deferred handlers to run afterwards.
If persistence failure messages are left unhandled, the default behavior is to stop the Actor, thus the handlers
will not be run.
events - event to be handled in the future, when preceeding persist operations have been processeshandler - handler for each eventpublic abstract void onReceiveRecover(java.lang.Object msg)
SnapshotOffer message
followed by events that are younger than the offered snapshot.
This handler must not have side-effects other than changing persistent actor state i.e. it should not perform actions that may fail, such as interacting with external services, for example.
If recovery fails, the actor will be stopped. This can be customized by
handling RecoveryFailure.
msg - (undocumented)Recoverpublic abstract void onReceiveCommand(java.lang.Object msg)
persist.
Commands sent to event sourced persistent actors must not be Persistent or
PersistentBatch messages. In this case an UnsupportedOperationException is
thrown by the persistent actor.
msg - (undocumented)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||