Class TestEntityRefImpl<M>

    • Constructor Detail

      • TestEntityRefImpl

        public TestEntityRefImpl​(java.lang.String entityId,
                                 ActorRef<M> probe,
                                 EntityTypeKey<M> typeKey)
    • Method Detail

      • 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>
      • 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>
      • 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>
      • 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.
      • 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>
      • toString

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