我在本地设置了两个演员但是有不同的演员系统。这里的目标是让演员A向演员B发送消息。
然而,我无法让演员A使用ActorSelection向演员B发送消息(远程处理),如下所示:
parent.ActorSelection("akka.tcp://RemoteSystem@localhost:8888/user/RemoteActor/ChildActor").Tell(msg)
错误"地址无效"会出来的。我做错了什么?
我在我的智慧结束。
编辑:
这是我的客户端配置:
let system =
let config = """
akka {
loglevel=DEBUG,
log-config-on-start = on,
#loggers="Akka.Logger.Serilog.SerilogLogger, Akka.Logger.Serilog"
actor {
provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
debug {
receive = on
autoreceive = on
lifecycle = on
event-stream = on
unhandled = on
}
remote {
helios.tcp {
transport-class = "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
applied-adapters = []
transport-protocol = tcp
port = 0
hostname = "localhost"
# Maximum frame size: 600KB
maximum-frame-size = 500000b
log-remote-lifecycle-events = DEBUG
}
}
}
"""
这是我的服务器配置:
let system =
let config = """
akka {
loglevel=DEBUG,
log-config-on-start = on,
#loggers="Akka.Logger.Serilog.SerilogLogger, Akka.Logger.Serilog"
actor {
provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
debug {
receive = on
autoreceive = on
lifecycle = on
event-stream = on
unhandled = on
}
remote {
helios.tcp {
transport-class = "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
applied-adapters = []
transport-protocol = tcp
port = 8888
hostname = "localhost"
# Maximum frame size: 600KB
maximum-frame-size = 600000b
log-remote-lifecycle-events = DEBUG
}
}
}
"""
以及来自客户端的输出:
[![error][1]][1]
另一件事是,为什么端口号总是回落到2552?我已经使用了app.config以及从内部代码解析。它仍在使用相同的端口号。