I'm doing some testing on remote lookup and dead watch. Therefore I use an
actor (see below) which simple resolves a given address and in the case we
got an actor-path back we start to watch them.
When writting the sample I made a type and forgot the @ between the IP
address and the akka-system name.
.. val lookupActor = client.actorOf(Props(new LookupActor("
*akka.tcp://server127.0.0.1:2567/user/DummyActor*")), "LookupActor")
Surprisingly this not existing actor could be resolved! The DeadLetters
actor seem to reply on my Identy. Is this an expected behavior?
*Log:*
[info] Found Server Actor..lets watch
akka.tasfcp://sasdferver127.0.0.1:2567/user/DummyActor his lifecycle
akka://clientSystem/deadLetters true
*Sample Actor*
class LookupActor(path: String) extends Actor {
sendIdentifyRequest()
/* same behaviour as below */
// def sendIdentifyRequest(): Unit = context.actorSelection(path) !
Identify(path)
def sendIdentifyRequest(): Unit =
context.actorSelection(path).resolveOne(Duration(5,"seconds")).map { ref =>
println("found actor identity: " + ref)
ActorIdentity(path, Some(ref))
}.pipeTo(self)
def receive = {
case ActorIdentity(`path`, Some(actor)) => println("Found Server
Actor..lets watch "+`path`+ " his lifecycle " + actor.path+"
"+actor.isTerminated)
context.watch(actor)
case ActorIdentity(`path`, None)=> println(s"Remote actor
not availible: $path")
case ReceiveTimeout => sendIdentifyRequest()
case Terminated(ref) => println("Remote actor
died..lets stop myself")
context.stop(self)
case _ => println("Unhandeld msg
received")
}
}
--
>>>>>>>>>> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.