Hi,
I am new in Akka.
Here's situation.
I am writing program which computes some math problem.
1 Experiment is computed by 1 EvaluationActor
No. of experiments might be thousands,or hundreds of thousends, even more.
Each EvaluationActor has child actor - ResultActor which collects stats 
from experiment.
Now, I have EvaluationScheduler type(which's non-actor) and want to collect 
stats from all experiments to show it.
According to documentation I should use Inbox class to be able to get multi 
replies from ResultActors.
Here's some test code for Inbox usage : 

def InboxTest = {
    implicit val as = ActorSystem()    
    
    val a = actor(new Act {
      become {
        case "hello" ⇒ sender ! "hi"
        case "hello1" ⇒ sender ! "hi1"
        case "hello2" ⇒ sender ! "hi2"
      }
    })
    
    implicit val i = inbox()
    a ! "hello"
    a ! "hello2"
    a ! "hello1"        
    
    i.receive().asInstanceOf[String].foreach(print _)
    print("\n")
    i.receive().asInstanceOf[String].foreach(print _)
    print("\n")
    i.receive().asInstanceOf[String].foreach(print _)
    print("\n")

The code is rough, but my thought was to show that I have to call receive() 
each time I want get next message.
Since I can't get mailboxsize will be tricky to know when check for next 
message.

So now, using this I need to build some mechanism to be sure that I have 
all stats from each ResultActor = each experiment.
Simple solution for this is counting received messages and maybe sending 
some experimentID or something.
But this's not solution, because if mailbox will be empty at I got :
java.util.concurrent.TimeoutException: deadline passed

Any better ideas/propositions?
Maybe there's better way more like "out of the box" in akka for such task?

regards
Darius.

-- 
>>>>>>>>>>      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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to