Search code examples
scalaakkaactor

Can Akka actor drop messages from its mailbox if needed?


For example, if I want to remove redundant messages from the queue - so that when actor recieves Connect message, it should inspect it's mailbox and remove other Connect messages, in order to do only one connect instead of several.

Is something like this possible?


Solution

  • Yes, you can configure the actors dispatcher to have any mailbox of your choice, so if you implement such a mailbox, you can use that, see the following section of the documentation: http://doc.akka.io/docs/akka/2.1.1/scala/dispatchers.html#Mailboxes