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.ddata
section, seereference.conf
.This is using the same underlying
Replicator
instance asDistributedData
and 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 T
apply(ActorSystem<?> system)
static DistributedData
createExtension(ActorSystem<?> system)
static boolean
equals(java.lang.Object other)
static DistributedData
get(ActorSystem<?> system)
static int
hashCode()
static ExtensionId<T>
id()
ActorRef<Replicator.Command>
replicator()
ActorRef
of theReplicator
.SelfUniqueAddress
selfUniqueAddress()
static <A,B extends ReplicatedData>
Behavior<A>withReplicatorMessageAdapter(scala.Function1<ReplicatorMessageAdapter<A,B>,Behavior<A>> factory)
When interacting with theDistributedData.replicator
from an actor theReplicatorMessageAdapter
provides 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.replicator
from an actor theReplicatorMessageAdapter
provides convenient methods that adapts the response messages to the requesting actor's message protocol.One
ReplicatorMessageAdapter
instance can be used for a givenReplicatedData
type, e.g. anOrSet[String]
. Interaction with severalKey
s can be used via the same adapter but they must all be of the sameReplicatedData
type. For interaction with several differentReplicatedData
types, e.g. anOrSet[String]
and aGCounter
, 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 asFuture
callbacks. It must not be shared between several actor instances.- Parameters:
factory
- Factory of theBehavior
for 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()
ActorRef
of theReplicator
.- See Also:
DistributedData.withReplicatorMessageAdapter
-
-