Hi Akka team,

I have a question about messages processing by an Actor. In the context of 
my Akka application, I defined an Actor with a similar behavior : 

case class Worker() extends Actor {


  trait Message
  case class M1(x : Int) extends Message
  case class M2(x : Int) extends Message


  trait Result
  case  Sucess(m : Message) extends Result
  case Failed(m : Message) extends Result 


  def processM1(m : M1) : Future[Result]


  def processM2(m : M2) : Future[Result]


  override def receive = {
    case m : M1 => this.processM1(m) pipeTo sender()
    case m : M2 => this.processM2(m) pipeTo sender()
  }
}




Imagine that mailbox of a worker *has 4 messages : M1, M2, M3, M4.*

It will process the mailbox messages per message starting by M1, then M2, 
then M3 and finally M4. 

My question about order processing is : Do an Actor wait the completion of 
current message before passing to the next one in the mailbox ?

Based on Akka mechanism, the answer seems to be no. If the actor system 
dispatcher has enough threads, it can process M1, M2, M3 and M4 in parallel 
but with respecting order of processing.  Did I am wrong ?

If I'm a wrong, Does Akka have a mechanism to wait for the completion of 
current message processing before passing to the next one ? 

In my application, worker actor defined in my question is a member of a 
ClusterGroup and I'm pushing messages to it so I was wondering if you have 
any advices to reach a such behaviour ? 

Alifirat Kilic. 

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to