首页 > akka 简单例子总是 not delivered和dead letters encountered,求大神帮看下

akka 简单例子总是 not delivered和dead letters encountered,求大神帮看下

package spark;
import akka.actor.{ Actor, Props, ActorSystem, ExtendedActorSystem }
import com.typesafe.config.ConfigFactory
import akka.remote._

object MyApp extends App {
  val actorSystem1 = ActorSystem("actorSystem1", ConfigFactory.parseString("""
    akka {
      remote {
        enabled-transports = ["akka.remote.netty.tcp"]
        netty.tcp {
          hostname = "127.0.0.1"
          port = 5155
        }
       }
    }
   """))
  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.actorSelection("akka.tcp://actorSystem1@localhost:" + 5155 + "/user/simplisticActor")

  remoteActor ! "TEST 1"
  remoteActor ! "TEST 2"
  remoteActor ! "TEST 2"

  Thread.sleep(1000)

  actorSystem1.shutdown()
  actorSystem2.shutdown()
}

http://blog.csdn.net/guotong1988/article/details/46816447

【热门文章】
【热门文章】