Class ClusterSharding
- java.lang.Object
-
- akka.cluster.sharding.typed.javadsl.ClusterSharding
-
- Type Parameters:
M- The type of message the entity acceptsE- A possible envelope around the message the entity accepts
- Direct Known Subclasses:
ClusterShardingImpl
public abstract class ClusterSharding extends java.lang.ObjectInitialize sharding for the givenentityfactory settings.It will start a shard region or a proxy depending on if the settings require role and if this node has such a role.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classClusterSharding.Passivate<M>static classClusterSharding.Passivate$static interfaceClusterSharding.ShardCommandWhen an entity is created anActorRef[ShardCommand]is passed to the factory method.
-
Constructor Summary
Constructors Constructor Description ClusterSharding()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract ShardCoordinator.ShardAllocationStrategydefaultShardAllocationStrategy(ClusterShardingSettings settings)The default is currentlyShardCoordinator.LeastShardAllocationStrategywith the givensettings.abstract <M> EntityRef<M>entityRefFor(EntityTypeKey<M> typeKey, java.lang.String entityId)Create anActorRef-like reference to a specific sharded entity.static ClusterShardingget(ActorSystem<?> system)abstract <M,E>
ActorRef<E>init(Entity<M,E> entity)abstract ActorRef<ClusterShardingQuery>shardState()Actor for querying Cluster Sharding state
-
-
-
Method Detail
-
get
public static ClusterSharding get(ActorSystem<?> system)
-
entityRefFor
public abstract <M> EntityRef<M> entityRefFor(EntityTypeKey<M> typeKey, java.lang.String entityId)
Create anActorRef-like reference to a specific sharded entity. Currently you have to correctly specify the type of messages the target can handle.Messages sent through this
EntityRefwill be wrapped in aShardingEnvelopeincluding the here providedentityId.For in-depth documentation of its semantics, see
EntityRef.- Parameters:
typeKey- (undocumented)entityId- (undocumented)- Returns:
- (undocumented)
-
shardState
public abstract ActorRef<ClusterShardingQuery> shardState()
Actor for querying Cluster Sharding state- Returns:
- (undocumented)
-
defaultShardAllocationStrategy
public abstract ShardCoordinator.ShardAllocationStrategy defaultShardAllocationStrategy(ClusterShardingSettings settings)
The default is currentlyShardCoordinator.LeastShardAllocationStrategywith the givensettings. This could be changed in the future.- Parameters:
settings- (undocumented)- Returns:
- (undocumented)
-
-