Class ReplicatedEntityProvider<M>
- java.lang.Object
-
- akka.cluster.sharding.typed.ReplicatedEntityProvider<M>
-
- Type Parameters:
M
- The type of messages the replicated entity accepts
public final class ReplicatedEntityProvider<M> extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description ReplicatedEntityProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <M> ReplicatedEntityProvider<M>
apply(java.lang.String typeName, scala.collection.immutable.Set<ReplicaId> allReplicaIds, scala.Function2<EntityTypeKey<M>,ReplicaId,ReplicatedEntity<M>> settingsPerReplicaFactory, scala.reflect.ClassTag<M> evidence$1)
Scala API:static <M> ReplicatedEntityProvider<M>
create(java.lang.Class<M> messageClass, java.lang.String typeName, java.util.Set<ReplicaId> allReplicaIds, Function2<EntityTypeKey<M>,ReplicaId,ReplicatedEntity<M>> settingsPerReplicaFactory)
Java API:static <M> ReplicatedEntityProvider<M>
createPerDataCenter(java.lang.Class<M> messageClass, java.lang.String typeName, java.util.Set<ReplicaId> allReplicaIds, java.util.function.Function<ReplicationId,Behavior<M>> createBehavior)
Java APIstatic <M> ReplicatedEntityProvider<M>
createPerRole(java.lang.Class<M> messageClass, java.lang.String typeName, java.util.Set<ReplicaId> allReplicaIds, Function<ReplicationId,Behavior<M>> createBehavior)
Java APIboolean
directReplication()
static <M,E>
ReplicatedEntityProvider<M>perDataCenter(java.lang.String typeName, scala.collection.immutable.Set<ReplicaId> allReplicaIds, scala.Function1<ReplicationId,Behavior<M>> create, scala.reflect.ClassTag<M> evidence$2)
Scala APIstatic <M,E>
ReplicatedEntityProvider<M>perRole(java.lang.String typeName, scala.collection.immutable.Set<ReplicaId> allReplicaIds, scala.Function1<ReplicationId,Behavior<M>> create, scala.reflect.ClassTag<M> evidence$3)
Scala APIscala.collection.immutable.Seq<scala.Tuple2<ReplicatedEntity<M>,java.lang.String>>
replicas()
ReplicatedEntityProvider<M>
withDirectReplication(boolean enabled)
Start direct replication over sharding when replicated sharding starts up, requires the entities to also have it enabled throughakka.persistence.typed.scaladsl.EventSourcedBehavior.withEventPublishing
orakka.persistence.typed.javadsl.ReplicatedEventSourcedBehavior.withEventPublishing
to work.
-
-
-
Method Detail
-
create
public static <M> ReplicatedEntityProvider<M> create(java.lang.Class<M> messageClass, java.lang.String typeName, java.util.Set<ReplicaId> allReplicaIds, Function2<EntityTypeKey<M>,ReplicaId,ReplicatedEntity<M>> settingsPerReplicaFactory)
Java API:Provides full control over the
ReplicatedEntity
and theEntity
Most use cases can use the<M>createPerDataCenter(java.lang.Class<M>,java.lang.String,java.util.Set<akka.persistence.typed.ReplicaId>,java.util.function.Function<akka.persistence.typed.ReplicationId,akka.actor.typed.Behavior<M>>)
and<M>createPerRole(java.lang.Class<M>,java.lang.String,java.util.Set<akka.persistence.typed.ReplicaId>,akka.japi.function.Function<akka.persistence.typed.ReplicationId,akka.actor.typed.Behavior<M>>)
-
apply
public static <M> ReplicatedEntityProvider<M> apply(java.lang.String typeName, scala.collection.immutable.Set<ReplicaId> allReplicaIds, scala.Function2<EntityTypeKey<M>,ReplicaId,ReplicatedEntity<M>> settingsPerReplicaFactory, scala.reflect.ClassTag<M> evidence$1)
Scala API:Provides full control over the
ReplicatedEntity
and theEntity
Most use cases can use the<M,E>perDataCenter(java.lang.String,scala.collection.immutable.Set<akka.persistence.typed.ReplicaId>,scala.Function1<akka.persistence.typed.ReplicationId,akka.actor.typed.Behavior<M>>,scala.reflect.ClassTag<M>)
and<M,E>perRole(java.lang.String,scala.collection.immutable.Set<akka.persistence.typed.ReplicaId>,scala.Function1<akka.persistence.typed.ReplicationId,akka.actor.typed.Behavior<M>>,scala.reflect.ClassTag<M>)
- Parameters:
typeName
- The type name used in theEntityTypeKey
-
perDataCenter
public static <M,E> ReplicatedEntityProvider<M> perDataCenter(java.lang.String typeName, scala.collection.immutable.Set<ReplicaId> allReplicaIds, scala.Function1<ReplicationId,Behavior<M>> create, scala.reflect.ClassTag<M> evidence$2)
Scala APICreate a
ReplicatedEntityProvider
that uses the defaults forEntity
when running in ClusterSharding. A replica will be run per data center.
-
perRole
public static <M,E> ReplicatedEntityProvider<M> perRole(java.lang.String typeName, scala.collection.immutable.Set<ReplicaId> allReplicaIds, scala.Function1<ReplicationId,Behavior<M>> create, scala.reflect.ClassTag<M> evidence$3)
Scala APICreate a
ReplicatedEntityProvider
that uses the defaults forEntity
when running in ClusterSharding. The replicas in allReplicaIds should be roles used by nodes. A replica for each entity will run on each role.
-
createPerDataCenter
public static <M> ReplicatedEntityProvider<M> createPerDataCenter(java.lang.Class<M> messageClass, java.lang.String typeName, java.util.Set<ReplicaId> allReplicaIds, java.util.function.Function<ReplicationId,Behavior<M>> createBehavior)
Java APICreate a
ReplicatedEntityProvider
that uses the defaults forEntity
when running in ClusterSharding. A replica will be run per data center.
-
createPerRole
public static <M> ReplicatedEntityProvider<M> createPerRole(java.lang.Class<M> messageClass, java.lang.String typeName, java.util.Set<ReplicaId> allReplicaIds, Function<ReplicationId,Behavior<M>> createBehavior)
Java APICreate a
ReplicatedEntityProvider
that uses the defaults forEntity
when running in ClusterSharding.Map replicas to roles and then there will be a replica per role e.g. to match to availability zones/racks
-
replicas
public scala.collection.immutable.Seq<scala.Tuple2<ReplicatedEntity<M>,java.lang.String>> replicas()
-
directReplication
public boolean directReplication()
-
withDirectReplication
public ReplicatedEntityProvider<M> withDirectReplication(boolean enabled)
Start direct replication over sharding when replicated sharding starts up, requires the entities to also have it enabled throughakka.persistence.typed.scaladsl.EventSourcedBehavior.withEventPublishing
orakka.persistence.typed.javadsl.ReplicatedEventSourcedBehavior.withEventPublishing
to work.
-
-