akkamailboxer

why actor module not support concurrent mailbox?


I'm fresh to akka, also actor,I wonder why can't find a concurrent mailbox to use.
As a result, I must define a dispatch actor send to its work actor.Many times, I not care about data's sequence and in this situation make message by sequence just cost time.


Solution

  • I find create actor with Router props is good choice:

    val actorRef: ActorRef = context.actorOf(Props[MyActor]
            .withRouter(RoundRobinPool(nrOfInstances = 4)), name = "myActor")
       //or 
    context.actorOf(RoundRobinPool(5).props(Props[MyActor]), "myActor")
    

    It will create four actor instance but return one actorRef -- RoundRobinPool handle and dispatch message to these actors.