Skip to content

Ch8 Actors - CheckActors gives dead letter errors #33

Open
@shafiquejamal

Description

@shafiquejamal

Hello, I'm having trouble with the CheckActors example in the book. When I try to run the following code:

class CheckActor extends Actor {

  import akka.actor.{Identify, ActorIdentity}
  val log = Logging(context.system, this)

  override def receive = {
    case path: String =>
      log.info(s"checking path $path")
      log.info(context.self.toString)
      log.info(context.parent.toString)
      context.actorSelection(path) ! Identify(path)
    case ActorIdentity(path, Some(ref)) =>
      log.info(s"found actor $ref at $path")
    case ActorIdentity(path, None) =>
      log.info(s"count not find an actor at path")

  }

}

// In main:
    val checker:ActorRef = ourSystem.actorOf(Props[CheckActor], "checker")
    checker ! "../*"

I get the following error (when running in the sbt console):

[INFO] [08/03/2016 14:55:29.998] [OurExampleSystem-akka.actor.default-dispatcher-2] [akka://OurExampleSystem/user/checker] checking path ../*
[INFO] [08/03/2016 14:55:29.999] [OurExampleSystem-akka.actor.default-dispatcher-2] [akka://OurExampleSystem/user/checker] Actor[akka://OurExampleSystem/user/checker#419406266]
[INFO] [08/03/2016 14:55:29.999] [OurExampleSystem-akka.actor.default-dispatcher-2] [akka://OurExampleSystem/user/checker] Actor[akka://OurExampleSystem/user]
[INFO] [08/03/2016 14:55:30.006] [OurExampleSystem-akka.actor.default-dispatcher-3] [akka://OurExampleSystem/user/checker] Message [akka.actor.ActorIdentity] from Actor[akka://OurExampleSystem/deadLetters] to Actor[akka://OurExampleSystem/user/checker#419406266] was not delivered. [1] dead letters encountered. This logging can be turned off or adjusted with configuration settings 'akka.log-dead-letters' and 'akka.log-dead-letters-during-shutdown'.
[success] Total time: 0 s, completed Aug 3, 2016 2:55:30 PM

I tried it with the code from the code files too, and get the same result (without the extra logging statements). Can you suggest what I might be doing wrong? Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions