How to do it...

  1. Bring the required dependencies to begin with.
  2. Edit the build.sbt file and add the Akka remote dependency as follows:
        libraryDependencies += "com.typesafe.akka" %           "akka-cluster-tools_2.11" % "2.4.17"

Then, run sbt update to retrieve the dependencies from the central repository.

  1. Create a new file named application-cluster-1.conf in the src/main/resources directory with the following contents:
        akka {          actor {            provider = "akka.cluster.ClusterActorRefProvider"          }          remote {            log-remote-lifecycle-events = off            enabled-transports = ["akka.remote.netty.tcp"]            netty.tcp {              hostname = "127.0.0.1"              port = 2552            }          }          cluster {            seed-nodes = [              "akka.tcp://ClusterSystem@127.0.0.1:2552",              "akka.tcp://ClusterSystem@127.0.0.1:2553"            ]          }        }

Get Akka Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.