Class ClusterSharding

  • Type Parameters:
    M - The type of message the entity accepts
    E - 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 given entity 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.

    • Constructor Detail

      • ClusterSharding

        public ClusterSharding()
    • Method Detail

      • init

        public abstract <M,​E> ActorRef<E> init​(Entity<M,​E> entity)
      • entityRefFor

        public abstract <M> EntityRef<M> entityRefFor​(EntityTypeKey<M> typeKey,
                                                      java.lang.String entityId)
        Create an ActorRef-like reference to a specific sharded entity.

        You have to correctly specify the type of messages the target can handle via the typeKey.

        Messages sent through this EntityRef will be wrapped in a ShardingEnvelope including the here provided entityId.

        For in-depth documentation of its semantics, see EntityRef.

        Parameters:
        typeKey - (undocumented)
        entityId - (undocumented)
        Returns:
        (undocumented)
      • entityRefFor

        public abstract <M> EntityRef<M> entityRefFor​(EntityTypeKey<M> typeKey,
                                                      java.lang.String entityId,
                                                      java.lang.String dataCenter)
        Create an ActorRef-like reference to a specific sharded entity running in another data center.

        You have to correctly specify the type of messages the target can handle via the typeKey.

        Messages sent through this EntityRef will be wrapped in a ShardingEnvelope including the provided entityId.

        For in-depth documentation of its semantics, see EntityRef.

        Parameters:
        typeKey - (undocumented)
        entityId - (undocumented)
        dataCenter - (undocumented)
        Returns:
        (undocumented)
      • shardState

        public abstract ActorRef<ClusterShardingQuery> shardState()
        Actor for querying Cluster Sharding state
        Returns:
        (undocumented)