Deploying remote actors programmatically on different nodes
In this recipe, we will see how to create remote actors programmatically without explicitly defining them in the configuration.Â
Getting ready
All the prerequisites are the same as before. We will reuse SimpleActor.scala
, application-1.conf
, and application-2.conf
from the previous recipe.
How to do it...
- Create a file named
RemoteActorProgramatically.scala
. Inside this, define two small Scala applications--RemoteActorsProgrammatically1
andRemoteActorsProgrammatically
--with anActorSystem
. In the second file, create an actor of the type SampleActor, using theÂwithDeploy
method:
package com.packt.chapter7 import akka.actor.{ActorSystem, Address, Deploy, Props} import akka.remote.RemoteScope object RemoteActorsProgrammatically1 extends App { Â val actorSystem = ActorSystem("RemoteActorsProgramatically1") } object RemoteActorsProgrammatically2 extends App { ...