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()
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://blog.csdn.net/guotong1988/article/details/46816447