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

public class PersistentShardCoordinator extends ShardCoordinator implements PersistentActor
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:
  • Constructor Details

  • Method Details

    • journal

      protected ActorRef journal()
      Specified by:
      journal in interface Eventsourced
    • journalPluginId

      public String journalPluginId()
      Description copied from interface: PersistenceIdentity
      Configuration id of the journal plugin servicing this persistent actor. When empty, looks in pekko.persistence.journal.plugin to find configuration entry path. When configured, uses journalPluginId as absolute path to the journal configuration entry. Configuration entry must contain few required fields, such as class. See src/main/resources/reference.conf.
      Specified by:
      journalPluginId in interface PersistenceIdentity
    • 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_$eq in interface StashSupport
    • persistenceId

      public String persistenceId()
      Description copied from interface: PersistenceIdentity
      Id of the persistent entity for which messages should be replayed.
      Specified by:
      persistenceId in interface PersistenceIdentity
    • receiveCommand

      public scala.PartialFunction<Object,scala.runtime.BoxedUnit> receiveCommand()
      Description copied from interface: Eventsourced
      Command 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 calling persist.
      Specified by:
      receiveCommand in interface Eventsourced
    • receiveRecover

      public scala.PartialFunction<Object,scala.runtime.BoxedUnit> receiveRecover()
      Description copied from interface: Eventsourced
      Recovery handler that receives persisted events during recovery. If a state snapshot has been captured and saved, this handler will receive a pekko.persistence.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 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:
      receiveRecover in interface Eventsourced
      See Also:
      • pekko.persistence.Recovery
    • receiveSnapshotResult

      public scala.PartialFunction<Object,scala.runtime.BoxedUnit> receiveSnapshotResult()
    • saveSnapshotWhenNeeded

      public void saveSnapshotWhenNeeded()
    • snapshotPluginId

      public String snapshotPluginId()
      Description copied from interface: PersistenceIdentity
      Configuration id of the snapshot plugin servicing this persistent actor. When empty, looks in pekko.persistence.snapshot-store.plugin to find configuration entry path. When configured, uses snapshotPluginId as absolute path to the snapshot store configuration entry. Configuration entry must contain few required fields, such as class. See src/main/resources/reference.conf.
      Specified by:
      snapshotPluginId in interface PersistenceIdentity
    • snapshotStore

      protected ActorRef snapshotStore()
      Description copied from interface: Snapshotter
      Snapshot store plugin actor.
      Specified by:
      snapshotStore in interface Eventsourced
      Specified by:
      snapshotStore in interface Snapshotter
    • typeName

      public String typeName()
      Specified by:
      typeName in class ShardCoordinator
    • unstashOneGetShardHomeRequest

      protected void unstashOneGetShardHomeRequest()
      Specified by:
      unstashOneGetShardHomeRequest in class ShardCoordinator
    • 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:
      update in class ShardCoordinator
    • waitingForStateInitialized

      public scala.PartialFunction<Object,scala.runtime.BoxedUnit> waitingForStateInitialized()