2.2 Spotlight: Mailbox Requirements
Ensuring that an actor has a certain type of message queue in its mailbox can now easily be accomplished. Simply have the actor mix in the parameterized trait RequiresMessageQueue. Here is an example of an actor tha requires a bounded message queue.
In order for Akka to know which mailbox to create for the actor, you need to map the type parameter of RequiresMessageQueue to a mailbox configuration like this.
When you create a BoundedActor it will be given a bounded-mailbox mailbox. If the actor has a different mailbox configured in deployment, then that will override this mapping. The message queue of the created mailbox will be checked against the required type and actor creation will fail if the message queue doesn’t conform to the required type.
Read more in the Akka mailbox documentation.