Class PersistentShardCoordinator
java.lang.Object
org.apache.pekko.cluster.sharding.ShardCoordinator
org.apache.pekko.cluster.sharding.PersistentShardCoordinator
- All Implemented Interfaces:
Actor,Stash,StashFactory,StashSupport,Timers,UnrestrictedStash,RequiresMessageQueue<DequeBasedMessageQueueSemantics>,Eventsourced,PersistenceIdentity,PersistenceRecovery,PersistenceStash,PersistentActor,Snapshotter
Singleton coordinator that decides where to allocate shards.
Users can migrate to using DData to store state then either Event Sourcing or ddata to store the remembered entities.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.pekko.cluster.sharding.ShardCoordinator
ShardCoordinator.AbstractShardAllocationStrategy, ShardCoordinator.ActorSystemDependentAllocationStrategy, ShardCoordinator.Internal$, ShardCoordinator.LeastShardAllocationStrategy, ShardCoordinator.RebalanceWorker$, ShardCoordinator.ShardAllocationStrategy, ShardCoordinator.ShardAllocationStrategy$, ShardCoordinator.StartableAllocationStrategyNested classes/interfaces inherited from interface org.apache.pekko.actor.Actor
Actor.emptyBehavior$, Actor.ignoringBehavior$Nested classes/interfaces inherited from interface org.apache.pekko.persistence.Eventsourced
Eventsourced.AsyncHandlerInvocation, Eventsourced.AsyncHandlerInvocation$, Eventsourced.PendingHandlerInvocation, Eventsourced.RecoveryTick, Eventsourced.RecoveryTick$, Eventsourced.StashingHandlerInvocation, Eventsourced.StashingHandlerInvocation$, Eventsourced.State -
Constructor Summary
ConstructorsConstructorDescriptionPersistentShardCoordinator(String typeName, ClusterShardingSettings settings, ShardCoordinator.ShardAllocationStrategy allocationStrategy) -
Method Summary
Modifier and TypeMethodDescriptionprotected ActorRefjournal()Configuration id of the journal plugin servicing this persistent actor.protected voidId of the persistent entity for which messages should be replayed.scala.PartialFunction<Object,scala.runtime.BoxedUnit> Command handler.scala.PartialFunction<Object,scala.runtime.BoxedUnit> Recovery handler that receives persisted events during recovery.scala.PartialFunction<Object,scala.runtime.BoxedUnit> voidConfiguration id of the snapshot plugin servicing this persistent actor.protected ActorRefSnapshot store plugin actor.typeName()protected void<E extends org.apache.pekko.cluster.sharding.ShardCoordinator.Internal.DomainEvent>
voidupdate(E evt, scala.Function1<E, scala.runtime.BoxedUnit> f) scala.PartialFunction<Object,scala.runtime.BoxedUnit> Methods inherited from class org.apache.pekko.cluster.sharding.ShardCoordinator
active, aliveRegions, aliveRegions_$eq, allocateShardHomesForRememberEntities, allRegionsRegistered, allRegionsRegistered_$eq, cluster, context, continueGetShardHome, continueRebalance, gracefulShutdownInProgress, gracefulShutdownInProgress_$eq, handleGetShardHome, hasAllRegionsRegistered, isMember, leastShardAllocationStrategy, log, minMembers, org$apache$pekko$actor$Actor$_setter_$context_$eq, org$apache$pekko$actor$Actor$_setter_$self_$eq, postStop, preparingForShutdown, preparingForShutdown_$eq, preStart, rebalanceInProgress, rebalanceInProgress_$eq, rebalanceWorkers, rebalanceWorkers_$eq, receiveTerminated, regionProxyTerminated, regionTerminated, regionTerminationInProgress, regionTerminationInProgress_$eq, removalMargin, self, sendHostShardMsg, shutdownShards, shuttingDown, state, state_$eq, stateInitialized, unAckedHostShards, unAckedHostShards_$eq, waitingForLocalRegionToTerminate, waitingForLocalRegionToTerminate_$eq, watchStateActorsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.pekko.actor.Actor
context, org$apache$pekko$actor$Actor$_setter_$context_$eq, org$apache$pekko$actor$Actor$_setter_$self_$eq, postRestart, preStart, self, sender, supervisorStrategyMethods inherited from interface org.apache.pekko.persistence.Eventsourced
_lastSequenceNr_$eq, aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, batchAtomicWrite, changeState, currentState_$eq, deleteMessages, eventBatch_$eq, flushBatch, flushJournalBatch, internalDefer, internalDeferAsync, internalDeleteMessagesBeforeSnapshot, internalPersist, internalPersistAll, internalPersistAllAsync, internalPersistAsync, journalBatch_$eq, lastSequenceNr, log, nextSequenceNr, onPersistFailure, onPersistRejected, onRecoveryFailure, onReplaySuccess, peekApplyHandler, pendingStashingPersistInvocations_$eq, recovering, recoveryFinished, recoveryRunning, recoveryStarted, requestRecoveryPermit, sendBatchedEventsToJournal, sequenceNr_$eq, setLastSequenceNr, snapshotSequenceNr, snapshotterId, startRecovery, stash, stashInternally, super$aroundPostRestart, super$aroundPostStop, super$aroundPreRestart, super$aroundPreStart, super$aroundReceive, super$stash, super$unhandled, unhandled, unstashAll, unstashInternally, updateLastSequenceNr, waitingRecoveryPermit, writeEventFailed, writeEventRejected, writeEventSucceeded, writeInProgress_$eqMethods inherited from interface org.apache.pekko.persistence.PersistenceRecovery
recoveryMethods inherited from interface org.apache.pekko.persistence.PersistenceStash
internalStashOverflowStrategyMethods inherited from interface org.apache.pekko.persistence.PersistentActor
defer, deferAsync, persist, persistAll, persistAllAsync, persistAsync, receiveMethods inherited from interface org.apache.pekko.persistence.Snapshotter
deleteSnapshot, deleteSnapshots, loadSnapshot, saveSnapshotMethods inherited from interface org.apache.pekko.actor.StashFactory
createStashMethods inherited from interface org.apache.pekko.actor.StashSupport
actorCell, clearStash, context, enqueueFirst, prepend, self, theStash_$eq, unstash, unstashAllMethods inherited from interface org.apache.pekko.actor.Timers
actorCell, aroundPostStop, aroundPreRestart, aroundReceive, super$aroundPostStop, super$aroundPreRestart, super$aroundReceive, timersMethods inherited from interface org.apache.pekko.actor.UnrestrictedStash
postStop, preRestart, super$postStop, super$preRestart
-
Constructor Details
-
PersistentShardCoordinator
public PersistentShardCoordinator(String typeName, ClusterShardingSettings settings, ShardCoordinator.ShardAllocationStrategy allocationStrategy)
-
-
Method Details
-
journal
- Specified by:
journalin interfaceEventsourced
-
journalPluginId
Description copied from interface:PersistenceIdentityConfiguration id of the journal plugin servicing this persistent actor. When empty, looks inpekko.persistence.journal.pluginto find configuration entry path. When configured, usesjournalPluginIdas absolute path to the journal configuration entry. Configuration entry must contain few required fields, such asclass. Seesrc/main/resources/reference.conf.- Specified by:
journalPluginIdin interfacePersistenceIdentity
-
org$apache$pekko$actor$StashSupport$_setter_$mailbox_$eq
protected void org$apache$pekko$actor$StashSupport$_setter_$mailbox_$eq(DequeBasedMessageQueueSemantics x$1) - Specified by:
org$apache$pekko$actor$StashSupport$_setter_$mailbox_$eqin interfaceStashSupport
-
persistenceId
Description copied from interface:PersistenceIdentityId of the persistent entity for which messages should be replayed.- Specified by:
persistenceIdin interfacePersistenceIdentity
-
receiveCommand
Description copied from interface:EventsourcedCommand handler. Typically validates commands against current state (and/or by communication with other actors). On successful validation, one or more events are derived from a command and these events are then persisted by callingpersist.- Specified by:
receiveCommandin interfaceEventsourced
-
receiveRecover
Description copied from interface:EventsourcedRecovery handler that receives persisted events during recovery. If a state snapshot has been captured and saved, this handler will receive apekko.persistence.SnapshotOffermessage 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 there is a problem with recovering the state of the actor from the journal, the error will be logged and the actor will be stopped.
- Specified by:
receiveRecoverin interfaceEventsourced- See Also:
-
pekko.persistence.Recovery
-
receiveSnapshotResult
-
saveSnapshotWhenNeeded
public void saveSnapshotWhenNeeded() -
snapshotPluginId
Description copied from interface:PersistenceIdentityConfiguration id of the snapshot plugin servicing this persistent actor. When empty, looks inpekko.persistence.snapshot-store.pluginto find configuration entry path. When configured, usessnapshotPluginIdas absolute path to the snapshot store configuration entry. Configuration entry must contain few required fields, such asclass. Seesrc/main/resources/reference.conf.- Specified by:
snapshotPluginIdin interfacePersistenceIdentity
-
snapshotStore
Description copied from interface:SnapshotterSnapshot store plugin actor.- Specified by:
snapshotStorein interfaceEventsourced- Specified by:
snapshotStorein interfaceSnapshotter
-
typeName
- Specified by:
typeNamein classShardCoordinator
-
unstashOneGetShardHomeRequest
protected void unstashOneGetShardHomeRequest()- Specified by:
unstashOneGetShardHomeRequestin classShardCoordinator
-
update
public <E extends org.apache.pekko.cluster.sharding.ShardCoordinator.Internal.DomainEvent> void update(E evt, scala.Function1<E, scala.runtime.BoxedUnit> f) - Specified by:
updatein classShardCoordinator
-
waitingForStateInitialized
-