Class Effect.AskInitiated<Req,​Res,​T>

  • All Implemented Interfaces:
    java.io.Serializable, scala.Equals, scala.Product
    Enclosing class:
    Effect

    public static final class Effect.AskInitiated<Req,​Res,​T>
    extends Effect
    implements scala.Product, java.io.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:
    Serialized Form
    • Constructor Detail

      • AskInitiated

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

      • responseTimeout

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

        public java.lang.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​(java.lang.String msg)
      • adaptTimeout

        public T adaptTimeout()
      • getResponseTimeout

        public java.time.Duration getResponseTimeout()
        Java API
      • copy

        public <Req,​Res,​T> Effect.AskInitiated<Req,​Res,​T> copy​(RecipientRef<Req> target,
                                                                                       scala.concurrent.duration.FiniteDuration responseTimeout,
                                                                                       java.lang.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> java.lang.Class<Res> copy$default$3()
      • productPrefix

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

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

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

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

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

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

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

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

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