Class EntityRefImpl<M>

    • Constructor Detail

      • EntityRefImpl

        public EntityRefImpl​(ActorRef shardRegion,
                             java.lang.String entityId,
                             EntityTypeKeyImpl<M> typeKey,
                             scala.Option<java.lang.String> dataCenter)
    • Method Detail

      • $lessinit$greater$default$4

        public static <M> scala.Option<java.lang.String> $lessinit$greater$default$4()
      • entityId

        public java.lang.String entityId()
        Description copied from interface: EntityRef
        The identifier for the particular entity referenced by this EntityRef.

        
         // given sharding, typeKey
         sharding.entityRefFor(typeKey, "someId").entityId == "someId"  // always true
         
        Specified by:
        entityId in interface EntityRef<M>
      • dataCenter

        public scala.Option<java.lang.String> dataCenter()
        Description copied from interface: EntityRef
        The specified datacenter of the incarnation of the particular entity referenced by this EntityRef, if a datacenter was specified.
        Specified by:
        dataCenter in interface EntityRef<M>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • tell

        public void tell​(M msg)
        Description copied from class: EntityRef
        Send a message to the entity referenced by this EntityRef using *at-most-once* messaging semantics.
        Specified by:
        tell in interface EntityRef<M>
        Specified by:
        tell in interface RecipientRef<M>
        Specified by:
        tell in class EntityRef<M>
      • ask

        public <U> scala.concurrent.Future<U> ask​(scala.Function1<ActorRef<U>,​M> message,
                                                  Timeout timeout)
        Description copied from interface: EntityRef
        Allows to "ask" the EntityRef for a reply. See AskPattern for a complete write-up of this pattern

        Note that if you are inside of an actor you should prefer akka.actor.typed.scaladsl.ActorContext.ask as that provides better safety.

        Example usage:

        
         case class Request(msg: String, replyTo: ActorRef[Reply])
         case class Reply(msg: String)
        
         implicit val timeout = Timeout(3.seconds)
         val target: EntityRef[Request] = ...
         val f: Future[Reply] = target.ask(Request("hello", _))
         

        Please note that an implicit Timeout must be available to use this pattern.

        Specified by:
        ask in interface EntityRef<M>
      • ask

        public <U> java.util.concurrent.CompletionStage<U> ask​(Function<ActorRef<U>,​M> message,
                                                               java.time.Duration timeout)
        Description copied from class: EntityRef
        Allows to "ask" the EntityRef for a reply. See AskPattern for a complete write-up of this pattern

        Note that if you are inside of an actor you should prefer akka.actor.typed.javadsl.ActorContext.ask as that provides better safety.

        Specified by:
        ask in class EntityRef<M>
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface InternalRecipientRef<M>
        Returns:
        true if the actor is locally known to be terminated, false if alive or uncertain.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • withDataCenter

        public EntityRefImpl<M> withDataCenter​(scala.Option<java.lang.String> dataCenter)