I'm creating a system of actors using Java+Akka. In particular, I define untyped actors by providing an implementation of the onReceive() method.
In that method, I implement the behavior of the actor by defining the logic to be executed upon reception of a message. It may be something as:
public void onReceive(Object msg) throws Exception {
if(msg instanceof MsgType1){ ... }
else if(msg instanceof MsgType2){ ... }
else unhandled(msg);
}
However, what if the actor is interested in only a single type of msg? Is it possible to implement a selective receive, so that the actor waits for a certain msg (and the system automatically re-queues all the other types of messages)???