Class DistributedData
- java.lang.Object
-
- akka.cluster.ddata.typed.scaladsl.DistributedData
-
- All Implemented Interfaces:
Extension
public class DistributedData extends java.lang.Object implements Extension
Akka extension for convenient configuration and use of theReplicator. Configuration settings are defined in theakka.cluster.ddatasection, seereference.conf.This is using the same underlying
Replicatorinstance asDistributedDataand that means that typed and classic actors can share the same data.
-
-
Constructor Summary
Constructors Constructor Description DistributedData(ActorSystem<?> system)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Tapply(ActorSystem<?> system)static DistributedDatacreateExtension(ActorSystem<?> system)static booleanequals(java.lang.Object other)static DistributedDataget(ActorSystem<?> system)static inthashCode()static ExtensionId<T>id()ActorRef<Replicator.Command>replicator()ActorRefof theReplicator.SelfUniqueAddressselfUniqueAddress()static <A,B extends ReplicatedData>
Behavior<A>withReplicatorMessageAdapter(scala.Function1<ReplicatorMessageAdapter<A,B>,Behavior<A>> factory)When interacting with theDistributedData.replicatorfrom an actor theReplicatorMessageAdapterprovides convenient methods that adapts the response messages to the requesting actor's message protocol.
-
-
-
Constructor Detail
-
DistributedData
public DistributedData(ActorSystem<?> system)
-
-
Method Detail
-
get
public static DistributedData get(ActorSystem<?> system)
-
createExtension
public static DistributedData createExtension(ActorSystem<?> system)
-
withReplicatorMessageAdapter
public static <A,B extends ReplicatedData> Behavior<A> withReplicatorMessageAdapter(scala.Function1<ReplicatorMessageAdapter<A,B>,Behavior<A>> factory)
When interacting with theDistributedData.replicatorfrom an actor theReplicatorMessageAdapterprovides convenient methods that adapts the response messages to the requesting actor's message protocol.One
ReplicatorMessageAdapterinstance can be used for a givenReplicatedDatatype, e.g. anOrSet[String]. Interaction with severalKeys can be used via the same adapter but they must all be of the sameReplicatedDatatype. For interaction with several differentReplicatedDatatypes, e.g. anOrSet[String]and aGCounter, an adapter can be created for each type.*Warning*: A
ReplicatorMessageAdapterinstance 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 asFuturecallbacks. It must not be shared between several actor instances.- Parameters:
factory- Factory of theBehaviorfor the actor that is using theReplicatorMessageAdapter
-
apply
public static final T apply(ActorSystem<?> system)
-
hashCode
public static final int hashCode()
-
equals
public static final boolean equals(java.lang.Object other)
-
id
public static ExtensionId<T> id()
-
selfUniqueAddress
public SelfUniqueAddress selfUniqueAddress()
-
replicator
public ActorRef<Replicator.Command> replicator()
ActorRefof theReplicator.- See Also:
DistributedData.withReplicatorMessageAdapter
-
-