Sender becomes Actor[akka://Main/deadLetters]

Viewed 2016

I can't figure out why do I have the error "deadLetters"

class MyActor extends Actor {

  private def getIdList = Future { blocking(getIdListSync) }

  private def getIdListSync = {
    val inputStreamRaw = new URL(url).openConnection.getInputStream
    val inputStream = scala.io.Source fromInputStream inputStreamRaw
    val json = parse(inputStream getLines() mkString "\n")
    val jsonIds = json \ "ids" \\ classOf[JInt]
    jsonIds take idLimit map (_.toInt)
  }

  def receive = {
    case Get =>

        //doesn't work, the error is "sender" becomes "Actor[akka://Main/deadLetters]"

//      getIdList onComplete {
//        case Success(idList) =>
//          sender ! Result(idList)
//
//        case Failure(e) => // todo
//      }

      //works well
      val idList = getInternalIdListSync
      sender ! Result(idList)

  }
}

As you can see, sender becomes Actor[akka://Main/deadLetters] in case of using Future and blocking in the method titled getIdList. Why is that? Shouldn't I use that?

2 Answers
Related