Class DistributedData

java.lang.Object
org.apache.pekko.cluster.ddata.typed.javadsl.DistributedData
All Implemented Interfaces:
Extension

public abstract class DistributedData extends Object implements Extension
Pekko extension for convenient configuration and use of the Replicator. Configuration settings are defined in the pekko.cluster.ddata section, see reference.conf.

This is using the same underlying Replicator instance as pekko.cluster.ddata.DistributedData and that means that typed and classic actors can share the same data.

This class is not intended for user extension other than for test purposes (e.g. stub implementation). More methods may be added in the future and that may break such implementations.

  • Constructor Details

    • DistributedData

      public DistributedData()
  • Method Details

    • get

      public static DistributedData get(ActorSystem<?> system)
    • createExtension

      public static DistributedData createExtension(ActorSystem<?> system)
    • withReplicatorMessageAdapter

      public static <A, B extends ReplicatedData> Behavior<A> withReplicatorMessageAdapter(Function<ReplicatorMessageAdapter<A,B>,Behavior<A>> factory)
      When interacting with the DistributedData.replicator from an actor the ReplicatorMessageAdapter provides convenient methods that adapts the response messages to the requesting actor's message protocol.

      One ReplicatorMessageAdapter instance can be used for a given ReplicatedData type, e.g. an OrSet. Interaction with several pekko.cluster.ddata.Keys can be used via the same adapter but they must all be of the same ReplicatedData type. For interaction with several different ReplicatedData types, e.g. an OrSet and a GCounter, an adapter can be created for each type.

      *Warning*: A ReplicatorMessageAdapter instance is not thread-safe and must only be used from a single actor It must not be accessed from threads other than the ordinary actor message processing thread, such as CompletionStage callbacks. It must not be shared between several actor instances.

      Parameters:
      factory - Factory of the Behavior for the actor that is using the ReplicatorMessageAdapter

    • apply

      public static final T apply(ActorSystem<?> system)
    • hashCode

      public static final int hashCode()
    • equals

      public static final boolean equals(Object other)
    • id

      public static ExtensionId<T> id()
    • replicator

      public abstract ActorRef<Replicator.Command> replicator()
      ActorRef of the Replicator.

      See Also:
      • DistributedData.withReplicatorMessageAdapter
    • selfUniqueAddress

      public abstract SelfUniqueAddress selfUniqueAddress()