Developer
Developer

Reputation: 193

Going from local to remote actor messaging in AKKA

I have followed the recommended configuration:

   akka {
      actor {
        provider = "akka.remote.RemoteActorRefProvider"
      }
      remote {
        enabled-transports = ["akka.remote.netty.tcp"]
        netty.tcp {
          hostname = "127.0.0.1"
          port = 0
        }
      }
    }

And i am creating my actor system like so:

 implicit val system = ActorSystem("system239",  ConfigFactory.load("application")).asInstanceOf[ExtendedActorSystem]

The problem is that my ActorRef's paths are still 'short', i.e. describe a local paths. What am I missing?

Upvotes: 0

Views: 345

Answers (1)

johanandren
johanandren

Reputation: 11479

Remoting does not mean you automatically get actors distributed across the nodes, so creating a local actor is still a local actor, and an ActorRef to it will still be a local actor ref. What it gives you is the ability to deploy and interact actors across the nodes explicitly.

I would recommend you to read up on the docs http://doc.akka.io/docs/akka/2.3.14/scala/remoting.html and maybe take a look at the remoting activator template https://www.typesafe.com/activator/template/akka-sample-remote-scala to see how Akka Remoting works.

It might also be interesting to take a look at clustering for distributing your system as it contains more tools for common use cases (singleton across the system, sharding on id, eventually consistent data etc) and is more robust when it comes to failures.

Also: Akka 2.3 has reached end of life, so it might not be a good idea to start anything new on it, use 2.4 instead (or at least use the latest release of 2.3 which is 2.3.14)

Upvotes: 1

Related Questions