I am new to the world of Akka / Scala. I'm trying to figure out what is the best way to have something always done when an actor receives a message, even if there is no match for him. I know there receiveis PartialFunction, but I was wondering if there is a better way to do this than:
def receive: Receive = {
case string: String => {
functionIWantToCall()
println(string)
}
case obj: MyClass => {
functionIWantToCall()
doSomethingElse()
}
case _ => functionIWantToCall()
}
I am sure there is a better way in Scala to do this instead of calling functionIWantToCall()inside each case. Can anyone suggest something :)?
source
share