I have a distributed actor system, some on Windows, and some on a Linux machine. Sometimes one actor may need to connect another actor and make some messages. Of course, there are times when one of them is on Windows, and the other is on a Linux system.
Actors connect with each other using ActorSelection. The problem is that when a Windows actor tries to communicate with Linux, everything works fine. But when the Linux initiator initiates the link, ActorSelection.ResolveOne fails.
I made a small example here:
static void Main(string[] args)
{
ActorSystem system = ActorSystem.Create("TestSystem");
system.ActorOf(Props.Create(() => new ConnectActor()), "test");
while (true)
{
var address = Console.ReadLine();
if (string.IsNullOrEmpty(address))
{
system.Terminate();
return;
}
var remoteAddress = $"akka.tcp://{system.Name}@{address}/user/test";
try
{
var actor = system.ActorSelection(remoteAddress).ResolveOne(TimeSpan.FromMilliseconds(5000)).Result;
Console.WriteLine("Resolved: " + actor.Path);
}
catch (Exception ex)
{
Console.WriteLine("Failed: " + ex.Message);
}
}
}
The configuration in app.config is as follows:
akka {
loggers = ["Akka.Logger.NLog.NLogLogger, Akka.Logger.NLog"]
suppress-json-serializer-warning = on
loglevel = "DEBUG"
log-config-on-start = on
actor {
provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
debug {
receive = on
autoreceive = on
lifecycle = on
event-stream = on
unhandled = on
}
}
remote {
log-remote-lifecycle-events = DEBUG
log-received-messages = on
helios.tcp {
transport-class = "Akka.Remote.Transport.Helios.HeliosTcpTransport, Akka.Remote"
transport-protocol = tcp
applied-adapters = []
port = 9000
hostname = "0.0.0.0"
public-hostname = "192.168.0.251"
}
}
}
Public-hostname is the public ip address.
So here are the cases:
- When Windows / Windows starts, both instances see each other (I give them the remote address - they display "Allowed")
- Windows/Linux Linux windows "Resolved". , Linux. Windows linux- "Resolved" - , , .
- , Windiws/Linux Windows linux, "Failed". - . :
Akka.Remote.Transport.AkkaProtocolManager | akka://TestSystem/system/transports/akkaprotocolmanager.tcp.0/akkaProtocol-tcp%3A%2F%2FTestSystem%40%5B%3A%3Affff%3A192.168.0 0,252% 5D% 3A36983-1 |||| 13: 20: 08.3766 | DEBUGAkka.Remote.Transport.ProtocolStateActor | (Akka.Remote.Transport.ProtocolStateActor) |||| 13: 20: 08,3922 | DEBUG | Akka.Remote.Transport.ProtocolStateActor | ||||
: Akka.net,
, . ? Akka.NET , linux...
, - ? - Linux → Windows?