Sends a typed message asynchronously.
Sends a typed message asynchronously.
Ask a typed question asynchronously.
Ask a typed question asynchronously.
This signature enforces the replyTo
pattern for keeping type safety.
Instead of sending a message of Any
and replying to an untyped sender()
,
you supply a function that, given a typed sender, will return the message.
This is typically done with a second parameter list of a case class.
case class MyMessage(payload: String)(val replyTo: ActorRef[MyResponse]) class MyActor extends Actor { def receive = { case m@MyMessage(payload) => m.replyTo ! MyResponse(payload) } }
Returns an ActorRef that only handles a subpart of the given union type.