Packages

implicit final class Askable[Req] extends AnyVal

See ask

Req

The request protocol, what the other actor accepts

Source
AskPattern.scala
Linear Supertypes
Type Hierarchy
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Askable
  2. AnyVal
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new Askable(ref: RecipientRef[Req])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##: Int
    Definition Classes
    Any
  3. def +(other: String): String
    Implicit
    This member is added by an implicit conversion from Askable[Req] toany2stringadd[Askable[Req]] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (Askable[Req], B)
    Implicit
    This member is added by an implicit conversion from Askable[Req] toArrowAssoc[Askable[Req]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  6. def ?[Res](replyTo: (ActorRef[Res]) => Req)(implicit timeout: Timeout, scheduler: Scheduler): Future[Res]

    The ask-pattern implements the initiator side of a request–reply protocol.

    The ask-pattern implements the initiator side of a request–reply protocol. The ? operator is pronounced as "ask" (and a convenience symbolic operation kept since the previous ask API, if unsure which one to use, prefer the non-symbolic method as it leads to fewer surprises with the scope of the replyTo function)

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

    The party that asks may be within or without an Actor, since the implementation will fabricate a (hidden) ActorRef that is bound to a scala.concurrent.Promise. This ActorRef will need to be injected in the message that is sent to the target Actor in order to function as a reply-to address, therefore the argument to the ask / ? operator is not the message itself but a function that given the reply-to address will create the message.

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

    Note: it is preferrable to use the non-symbolic ask method as it easier allows for wildcards for the replyTo: ActorRef.

    Res

    The response protocol, what the other actor sends back

  7. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  8. def ask[Res](replyTo: (ActorRef[Res]) => Req)(implicit timeout: Timeout, scheduler: Scheduler): Future[Res]

    The ask-pattern implements the initiator side of a request–reply protocol.

    The ask-pattern implements the initiator side of a request–reply protocol.

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

    The party that asks may be within or without an Actor, since the implementation will fabricate a (hidden) ActorRef that is bound to a scala.concurrent.Promise. This ActorRef will need to be injected in the message that is sent to the target Actor in order to function as a reply-to address, therefore the argument to the ask / ? operator is not the message itself but a function that given the reply-to address will create the message.

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

    The response protocol, what the other actor sends back

    Annotations
    @nowarn()
  9. def askWithStatus[Res](replyTo: (ActorRef[StatusReply[Res]]) => Req)(implicit timeout: Timeout, scheduler: Scheduler): Future[Res]

    The same as ask but only for requests that result in a response of type akka.pattern.StatusReply.

    The same as ask but only for requests that result in a response of type akka.pattern.StatusReply. If the response is a akka.pattern.StatusReply.Success the returned future is completed successfully with the wrapped response. If the status response is a akka.pattern.StatusReply.Error the returned future will be failed with the exception in the error (normally a akka.pattern.StatusReply.ErrorMessage).

  10. def ensuring(cond: (Askable[Req]) => Boolean, msg: => Any): Askable[Req]
    Implicit
    This member is added by an implicit conversion from Askable[Req] toEnsuring[Askable[Req]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  11. def ensuring(cond: (Askable[Req]) => Boolean): Askable[Req]
    Implicit
    This member is added by an implicit conversion from Askable[Req] toEnsuring[Askable[Req]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  12. def ensuring(cond: Boolean, msg: => Any): Askable[Req]
    Implicit
    This member is added by an implicit conversion from Askable[Req] toEnsuring[Askable[Req]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  13. def ensuring(cond: Boolean): Askable[Req]
    Implicit
    This member is added by an implicit conversion from Askable[Req] toEnsuring[Askable[Req]] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  14. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. val ref: RecipientRef[Req]
  17. def toString(): String
    Definition Classes
    Any

Deprecated Value Members

  1. def formatted(fmtstr: String): String
    Implicit
    This member is added by an implicit conversion from Askable[Req] toStringFormat[Askable[Req]] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.12.16) Use formatString.format(value) instead of value.formatted(formatString), or use the f"" string interpolator. In Java 15 and later, formatted resolves to the new method in String which has reversed parameters.

  2. def [B](y: B): (Askable[Req], B)
    Implicit
    This member is added by an implicit conversion from Askable[Req] toArrowAssoc[Askable[Req]] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use -> instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.

Inherited from AnyVal

Inherited from Any

Inherited by implicit conversion any2stringadd fromAskable[Req] to any2stringadd[Askable[Req]]

Inherited by implicit conversion StringFormat fromAskable[Req] to StringFormat[Askable[Req]]

Inherited by implicit conversion Ensuring fromAskable[Req] to Ensuring[Askable[Req]]

Inherited by implicit conversion ArrowAssoc fromAskable[Req] to ArrowAssoc[Askable[Req]]

Ungrouped