Hi Zara, Akka implements at-most-once delivery semantics, meaning that messages can be lost. Therefore you need to handle the case that you don’t get an ActorIdentity back, in which case you retry after a timeout.
Regards, Roland 26 feb 2014 kl. 15:47 skrev Zava <[email protected]>: > Hi all > I used akka remote to build my software. > in hostA, there's a actorA. > in hostB, there's a actorB. > > and I use Idenyify to find the actorB, the pseudo code like this: > > class actorA extends Actor { > def receive = { > case INIT => > val actorB = > context.system.actorSelection("akka.tcp://akka@hostB:2552/user/actorB") > actorB ! Identify(1L) > case ActorIdentity(1L, None) => > // find it again > import context.dispatcher > context.system.scheduler.scheduleOnce(1 seconds, self, INIT) > case ActorIdentity(1L, Some(actor)) => > context.watch(actor) > // start send message to actorB > case Terminated(`actor`) => > // if the terminated actor is actorB, we will find it again > context.unwatch(actor) > import context.dispatcher > context.system.scheduler.scheduleOnce(1 seconds, self, INIT) > } > } > > > I think this will be reconnect actorB if the connect lost, but I was wrong. > when the code runs, I found it can't work sometimes, because the actorA can't > recieve any ActorIdentity mesage. > so actorA can't try to selection actorB again. > > how can I be sure to make actorA reconnect actorB when connection lost ? ( or > connection doesn't lost but actorA sent message to deadLetter insteadOf > actorB ) > > thanks > > -- > >>>>>>>>>> Read the docs: http://akka.io/docs/ > >>>>>>>>>> Check the FAQ: http://akka.io/faq/ > >>>>>>>>>> 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/groups/opt_out. Dr. Roland Kuhn Akka Tech Lead Typesafe – Reactive apps on the JVM. twitter: @rolandkuhn -- >>>>>>>>>> Read the docs: http://akka.io/docs/ >>>>>>>>>> Check the FAQ: http://akka.io/faq/ >>>>>>>>>> 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/groups/opt_out.
