最近在学习akka,写了个特别简单的helloword例子,但是从local给remote发消息的时候总是提示 message not delivered,找了很长时间才发现导致这个问题的原因,我的错误源于在local 获取remote 的引用的时候,路径中的
val worker1 = context.actorSelection("akka.tcp://Worker1@10.175.37.91:2553/user/worker1")
其中 worker1 在remote中写的是Worker1 ,因为这里大小写写错了,所以local找不到Remote 导致了消息发送失败,真是细节决定成败啊!!
导致message not delivered的原因一般有
1.远程actor 不存在
2.远程actor已经关闭等