nocturnal
nocturnal

Reputation: 395

AKKA clustering: send and recieve actor messages between 2 remote nodes

I have 2 project (sbt), say projectA and projectB. projectA dependsOn projectB. How do i configure akka cluster such that both the projects passes messages using actors? Both projectA and projectB forms a cluster with seed -nodes.

Upvotes: 1

Views: 991

Answers (1)

Christopher Batey
Christopher Batey

Reputation: 684

If you want to send a message to a specific actor you can look up remote actors via actorSelection:

val selection context.actorSelection("akka.tcp://actorSystemName@10.0.0.1:2552/user/actorName")

Lots of details in the docs here: https://doc.akka.io/docs/akka/2.5/remoting.html

Of you can make use of a feature like ClusterSharding or ClusterSingleton where you don't need to create the actors, just send messages and Akka will create them for you.

Upvotes: 1

Related Questions