Packages

implicit final class Askable[T] extends AnyVal

See ?

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. All

Instance Constructors

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

Value Members

  1. def ?[U](replyTo: (ActorRef[U]) ⇒ T)(implicit timeout: Timeout, scheduler: Scheduler): Future[U]

    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".

    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 scheduler = system.scheduler
    implicit val timeout = Timeout(3.seconds)
    val target: ActorRef[Request] = ...
    val f: Future[Reply] = target ? replyTo => (Request("hello", replyTo))
  2. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  3. val ref: RecipientRef[T]