I have a small Scala application that's using Akka actors. In the course of doing some refactoring, I've encountered a completely unexpected situation that I've been unable to debug.
I have nodes in a graph that send messages to each other. In fact, they all send messages to a single actor who turns around and directs them back to the appropriate target, but I doubt that's especially relevant.
My "NodeActor" has a receive method:
final def receive: PartialFunction[Any,Unit] = {
case NInit() => ...
case NStart() => ...
case m: Any =>
log.error(s"Unexpected message: $m")
}
I have started to get the unexpected message error where $m
is a bare tuple. It's being sent by the central monitoring actor, but I cannot for the life of me work out how. All of the messages sent by the graph monitor look like properly formatted case class instances. I've attempted unsuccessfully to get Akka to log ever sent and received method.
Eventually, I discovered aroundReceive
and implemented a primitive version of that which simply logs the received message. None of the messages that pass through that method are just a bare tuple.
I completely baffled about how to proceed. Suggestions most welcome.
sender
method that you can call from thereceive
function. – Dylan