scalaakkaakka-clusterakka-remote-actor

Akka how to reach remote actors in cluster


First I would like to say that I am very new to Akka and actors :)

I would like to create a distributed application. I will split the application in a web part(REST API) and a user management part. But what is the right way to access an actor from another part of the application?

I know that I can access an actor selection by providing its address (https://doc.akka.io/docs/akka/2.5/remoting.html#looking-up-remote-actors), but isn't there a way where I don't have to work with addresses?

I just want to create a system where it is very easy to reach a remote actor without using their addresses.


Solution

  • In Cluster Sharding the actor identity is persistanceId and must be part of message which you send to whole cluster. Thats why you need to define extractEntityId.

    Read more in documentation: https://doc.akka.io/docs/akka/2.5/cluster-sharding.html