Hey,

    I want to create a Timer Actor that tracks the progress of the entire 
program (and also estimate remaining execution time). Since the timer actor 
will have to hold mutable variable aka "current progress", I think it 
should be constructed under the highest supervisor instead of being spawned 
by lower actors. So I created this:

object Entry extends App {
    val system: ActorSystem = ActorSystem("Twitter")
    val sup = system.actorOf(Props[Supervisor])
    sup ! Sentence(.....)
}

class Supervisor extends Actor {

  def receive = {
    case sen: Sentence =>
      val timer = context.actorOf(Props[Timer])
      val pcfg = context.actorOf(Props[PCFGParser])
      pcfg ! sen.copy()
  }
}

Then I have this lower actor that does all the actions:

class PCFGParser extends Actor{

   def receive = {
     case sen: Sentence =>
       //....business logic
        val ps = context.actorOf(Props[PatternSearch]) //create another 
actor
        ps ! sen.copy(tree = Some(tree))
        context.actorSelection("../timer") ! PCFGAddOne
   }
}

So at this point, I think it should send messages back to that Timer Actor. 
BUT HOW!? I tried actorSelection, but all I got were "dead letter" errors. 
The message was not delivered. And it also seems like this PCFGParser actor 
failed to send messages to both its child actor and Timer Actor:

[INFO] [06/03/2014 01:35:25.290] [Twitter-akka.actor.default-dispatcher-4] 
[akka://Twitter/user/$a/$h/$a] Message 
[TwitterProject.PCFGParserMsg$Sentence] from 
Actor[akka://Twitter/user/$a/$h#11
90256968] to Actor[akka://Twitter/user/$a/$h/$a#-1918790382] was not 
delivered. [6] dead letters encountered. 

[INFO] [06/03/2014 01:35:25.291] [Twitter-akka.actor.default-dispatcher-17] 
[akka://Twitter/user/$a/$d/../timer] Message 
[TwitterProject.TimerMsg$PCFGAddOne$] from Actor[akka://Twitter/user/$a/
$d#-1685001108] to Actor[akka://Twitter/user/$a/$d/../timer] was not 
delivered. [7] dead letters encountered. 

First, I admit there could be some error that's inside the business logic 
of this actor that caused this error (or really?? Could a dead actor 
triggers message not delivered error?) Second, what's the right way for 
this PCFGParser actor to send message to a distant actor?

Thank you!

-- 
>>>>>>>>>>      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