I am new to akka actor system. I am a bit confused about how a actor system is named. if I write
ActorSystem _system1 = ActorSystem.create("multi");
ActorSystem _system2 = ActorSystem.create("multi");
ActorSystem _system3 = ActorSystem.create("multi");
what is gonna happen in the background? Will there be 3 different instances of the actor system in the JVM? if yes, then how do I access the actors belonging to these actor systems over remoting?
Yes, it's possible (though probably not advised) to have 3 different
ActorSystem
s contained in a single JVM. I say "not advised" because actor systems are heavy weight resources (thread pools etc...) and having multiple in a single JVM can be counter productive.Now, in regards to remoting, in order to run these three in the same JVM, you will need to set up a different remoting bind port (property
akka.remote.netty.tcp.port
) for each actor system or else you will end up with port conflict issues. If you do that properly you should be able to differentiate the different actor systems because the port is included in the path. So for example, if you bound the first actor system to 2552, then the remote path to communicate with an actor bound to name "foo" under the root system would be:So it's certainly possible to do what you want, but again, it's not recommended...