I am having a strange behaviour on my akka Project. To summarize: I have two Actorsystems running on my hostsystem and want to connect from one to another to send messages. Now the Problem is, when I use the following akka configuration on my client:
akka {
actor {
provider = remote
}
remote {
enabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = "127.0.0.1"
port = 0
}
}
}
and the following on my server actorsystem:
akka {
loglevel = "INFO"
actor {
provider = "akka.remote.RemoteActorRefProvider"
}
remote {
enabled-transports = ["akka.remote.netty.tcp"]
netty.tcp {
hostname = "127.0.0.1"
port = 5150
}
log-sent-messages = on
log-received-messages = on
}
}
I cannot connect to my server actorsystem using an actorselection as follows:
val selection = context.actorSelection("akka.tcp://ServerSystem@0.0.0.0:5150/user/receiver")
I would expect it to work with a wildcard IP address, because it means that it tried to connect to each IPv4 the hostsystem has. I am getting following error:
[WARN] [05/06/2019 08:57:03.738] [New I/O boss #3] [NettyTransport(akka://ClientSystem)] Remote connection to [null] failed with java.net.ConnectException: Connection refused: no further information: /0.0.0.0:5150
[WARN] [05/06/2019 08:57:03.738] [ClientSystem-akka.remote.default-remote-dispatcher-13] [akka.tcp://ClientSystem@127.0.0.1:8346/system/endpointManager/reliableEndpointWriter-akka.tcp%3A%2F%2FServerSystem%400.0.0.0%3A5150-0] Association with remote system [akka.tcp://ServerSystem@0.0.0.0:5150] has failed, address is now gated for [5000] ms. Reason: [Association failed with [akka.tcp://ServerSystem@0.0.0.0:5150]] Caused by: [java.net.ConnectException: Connection refused: no further information: /0.0.0.0:5150]
On the other hand it is working just fine if I change 127.0.0.1 on the server config to 0.0.0.0 when I run it inside a docker container and connect to it using the 0.0.0.0 address in the actor selection on my client, which is running on the host. So here it seems to work binding and connecting to the wildcard IP.
Does anyone have an explanation to this behaviour?