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.Object
Initialize sharding for the givenentity
factory 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 class
ClusterSharding.Passivate<M>
static class
ClusterSharding.Passivate$
static interface
ClusterSharding.ShardCommand
When 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.ShardAllocationStrategy
defaultShardAllocationStrategy(ClusterShardingSettings settings)
The default is currentlyShardCoordinator.LeastShardAllocationStrategy
with the givensettings
.abstract <M> EntityRef<M>
entityRefFor(EntityTypeKey<M> typeKey, java.lang.String entityId)
Create anActorRef
-like reference to a specific sharded entity.static ClusterSharding
get(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
EntityRef
will be wrapped in aShardingEnvelope
including 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.LeastShardAllocationStrategy
with the givensettings
. This could be changed in the future.- Parameters:
settings
- (undocumented)- Returns:
- (undocumented)
-
-