EDIT Please note: I needed to make reverse changes to this https://github.com/akka/akka/commit/ce014ece3568938b2036c4ccfd21b92faba69607#L13L6 in order to make the accepted response work with AKKA 2.1, which is the stable distribution found on the akkas home page!
I read all the training materials that I could find in AKKA, but found nothing out of the box.
Using eclipse, I want to create 2 programs.
Program1: the actor "joe" starts and somehow makes it available at 127.0.0.1:some_port
Program2: gets a link to the actor "joe" at 127.0.0.1:some_port. Sends a welcome message "joe".
Program 1 must print something when a message is received. I want to run this example in eclipse using AKKA 2.1. Can someone list 2 programs (program1 and program2) along with a working application.conf file that does this and nothing more?
edit> let me show you what i got so far:
actor
case class Greeting(who: String) extends Serializable class GreetingActor extends Actor with ActorLogging { def receive = { case Greeting(who) ⇒ println("Hello " + who);log.info("Hello " + who) } }
Program1
package test import akka.actor.ActorSystem object Machine1 { def main(args: Array[String]): Unit = { val system = ActorSystem("MySystem") } }
Program2
package test import akka.actor.ActorSystem import akka.actor.Props import akka.actor.actorRef2Scala object Machine2 { def main(args: Array[String]): Unit = { val system = ActorSystem("MySystem") val greeter = system.actorOf(Props[GreetingActor], name = "greeter") greeter ! Greeting("Felix") } }
application.conf
akka { actor { deployment { /greeter { remote = "akka:// MySystem@127.0.0.1 :2553" } } } }
However, this program works when I run only Program2 and gives:
Hello Felix [INFO] [02/18/2013 12:27:29.999] [MySystem-akka.actor.default-dispatcher-2] [akka://MySystem/user/greeter] Hello Felix
It does not seem to pick my application.conf. I tried placing it in the. / Src / and. / Folder of my eclipse project. No difference. In addition, I know that this is really a demote deployment, but I only need a welcome program to work with AKKA. I spent so much time on this without getting a simple working application.