Class Effect.AskInitiated<Req,Res,T>

java.lang.Object
org.apache.pekko.actor.testkit.typed.Effect
org.apache.pekko.actor.testkit.typed.Effect.AskInitiated<Req,Res,T>
All Implemented Interfaces:
Serializable, scala.Equals, scala.Product
Enclosing class:
Effect

public static final class Effect.AskInitiated<Req,Res,T> extends Effect implements scala.Product, Serializable
The behavior initiated an ask via its context. A response or timeout may be sent via this effect to the asking behavior: this effect enforces that at most one response or timeout is sent. Alternatively, one may, after obtaining the effect, test the response adaptation function (without sending a message to the asking behavior) arbitrarily many times via the 'adaptResponse and adaptTimeout methods.

The 'replyToRef' is exposed so that the target inbox can expect the actual message sent to initiate the ask.

Note that this requires the ask to be initiated via the ActorContext. The Future returning ask is not testable in the BehaviorTestKit.

See Also:
  • Constructor Details

    • AskInitiated

      public AskInitiated(RecipientRef<Req> target, scala.concurrent.duration.FiniteDuration responseTimeout, Class<Res> responseClass, Req askMessage, scala.Function1<scala.util.Try<Res>,scala.runtime.BoxedUnit> forwardResponse, scala.Function1<scala.util.Try<Res>,T> mapResponse)
  • Method Details

    • target

      public RecipientRef<Req> target()
    • responseTimeout

      public scala.concurrent.duration.FiniteDuration responseTimeout()
    • responseClass

      public Class<Res> responseClass()
    • askMessage

      public Req askMessage()
    • respondWith

      public void respondWith(Res response)
    • timeout

      public void timeout()
    • adaptResponse

      public T adaptResponse(Res response)
    • adaptTimeout

      public T adaptTimeout(String msg)
    • adaptTimeout

      public T adaptTimeout()
    • getResponseTimeout

      public Duration getResponseTimeout()
      Java API
    • copy

      public <Req, Res, T> Effect.AskInitiated<Req,Res,T> copy(RecipientRef<Req> target, scala.concurrent.duration.FiniteDuration responseTimeout, Class<Res> responseClass, Req askMessage, scala.Function1<scala.util.Try<Res>,scala.runtime.BoxedUnit> forwardResponse, scala.Function1<scala.util.Try<Res>,T> mapResponse)
    • copy$default$1

      public <Req, Res, T> RecipientRef<Req> copy$default$1()
    • copy$default$2

      public <Req, Res, T> scala.concurrent.duration.FiniteDuration copy$default$2()
    • copy$default$3

      public <Req, Res, T> Class<Res> copy$default$3()
    • productPrefix

      public String productPrefix()
      Specified by:
      productPrefix in interface scala.Product
    • productArity

      public int productArity()
      Specified by:
      productArity in interface scala.Product
    • productElement

      public Object productElement(int x$1)
      Specified by:
      productElement in interface scala.Product
    • productIterator

      public scala.collection.Iterator<Object> productIterator()
      Specified by:
      productIterator in interface scala.Product
    • canEqual

      public boolean canEqual(Object x$1)
      Specified by:
      canEqual in interface scala.Equals
    • productElementName

      public String productElementName(int x$1)
      Specified by:
      productElementName in interface scala.Product
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object x$1)
      Specified by:
      equals in interface scala.Equals
      Overrides:
      equals in class Object