Akka Actors communicate example
In this example, we will discuss how Actors communicate with each other, which means how one Actor sends a message to second Actor, and how it receives and processes the messages from the second Actor:

Follow these steps to develop and test this akkacommunicate-app application:
- Create an SBT Project in IDE. Here, I'll use
helloworld-appas my SBT project name. - Add the
akka-actormodule configuration to thebuild.sbtfile:
build.sbt:
name := "akkacommunicate-app"
version := "1.0"
scalaVersion := "2.12.2"
libraryDependencies ++= Seq("com.typesafe.akka" %% "akka-actor" %
"2.5.9") - Create greeting messages as Case classes and Case object(s), as shown:
GreetingMessages.scala:
package com.packt.publishing.reactive.communicate
case class GoodMorning(name: String)
case object HowDoYouDo
case class GoodBye(name: String) - Create
PersonOneActorwith its messages processing logic, as illustrated:
PersonOneActor.scala:
...