"Dead letters" error when starting deleted AKKA members

I am trying to run remote members using AKKA on my localhost, but every time I get this error. Dead letters are written in it. I searched the Internet and found out that this error occurs when actors receive a message after the stream stops. Therefore, I am looking for a way to keep actors on remote machines. I use akk actors, not scala actors.

[INFO] [09/16/2013 18:44:51.426] [run-main] [Remoting] Starting remoting [INFO] [09/16/2013 18:44:51.688] [run-main] [Remoting] Remoting started; listening on addresses :[akka.tcp:// actorSystem1@localhost :2209] [INFO] [09/16/2013 18:44:51.759] [actorSystem2-akka.actor.default-dispatcher-5] [akka://actorSystem2/deadLetters] Message [java.lang.String] from Actor[akka://actorSystem2/deadLetters] to Actor[akka://actorSystem2/deadLetters] 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'. 

Below is the code.

 import akka.actor.{Actor, Props, ActorSystem} import com.typesafe.config.ConfigFactory import akka.remote._ object MyApp extends App { val actorSystem1 = ActorSystem("actorSystem1", ConfigFactory.parseString(""" akka { actor { provider = "akka.remote.RemoteActorRefProvider" } remote { transport = ["akka.remote.netty.tcp"] netty.tcp { hostname = "localhost" port = 2209 } } } """)) val actorSystem2 = ActorSystem("actorSystem2") actorSystem1.actorOf(Props(new Actor { def receive = { case x: String => Thread.sleep(1000) println("RECEIVED MESSAGE: " + x) } }), "simplisticActor") val remoteActor = actorSystem2.actorFor("akka:// actorSystem1@localhost :2209/user/simplisticActor") remoteActor ! "TEST 1" remoteActor ! "TEST 2" Thread.sleep(1000) actorSystem1.shutdown() actorSystem2.shutdown() } 

Thanks in advance.

+7
scala actor akka remoting
source share
1 answer

I think I see several problems with your code that can lead to table creation. Firstly, if you intend to find an actor on a remote system from actorSystem2 to actorSystem1 , you still need to configure the remote access properties for actorSystem1 , in particular, you need to make sure that it uses RemoteActorRefProvider . If you do not, system 2 will not be able to find the remote actor in system 1. After you make this change, I would also change the search for remote users with:

 val remoteActor = actorSystem2.actorFor("akka:// actorSystem1@localhost :2209/user/simplisticActor") 

in

 val remoteActor = actorSystem2.actorSelection("akka.tcp:// actorSystem1@localhost :2209/user/simplisticActor") 

actorFor method actorFor deprecated, and I think you stopped the .tcp part of .tcp protocol to look for a remote member.

Make these changes, and then see if everything works for you.

+6
source share

All Articles