In the following actor definition:
class MyActor extends Actor {
override def preStart(): Unit = {
super.preStart()
self ! M1("from M1")
}
def receive = initial("initial state")
def initial(str: String): Receive = {
case m1: M1 =>
self ! M3("from M3")
context.become(active(str))
case m2: M2 => println(m2.str)
}
def active(str: String): Receive = {
case m1: M1 => println(m1.str)
case m3: M3 => println(m3.str)
case str: String => println(s"string in active is ${str}")
}
}
When I run this as
val f = Await.result(myActor ? M1("hello world"), 10 seconds)
I get to see the following printed:
from M1
from M3
Where did my hello world go? It should have been in the Mailbox?
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.