Created
December 5, 2020 22:08
-
-
Save Slesa/7a59f5593c142a70234d21348ac27fef to your computer and use it in GitHub Desktop.
Scala Hello World
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val AkkaVersion = "2.6.10" | |
val AkkaPersistenceCassandraVersion = "1.0.3" | |
val AkkaHttpVersion = "10.2.1" | |
val AkkaProjectionVersion = "1.0.0" | |
lazy val `akka-hello-world` = project | |
.in(file(".")) | |
.settings( | |
organization := "de.slesa.akka.samples", | |
version := "0.1", | |
scalaVersion := "2.13.3", | |
scalacOptions in Compile ++= Seq("-deprecation", "-feature", "-unchecked", "-Xlog-reflective-calls", "-Xlint"), | |
javacOptions in Compile ++= Seq("-Xlint:unchecked", "-Xlint:deprecation"), | |
libraryDependencies ++= Seq( | |
"com.typesafe.akka" %% "akka-slf4j" % AkkaVersion, | |
"com.typesafe.akka" %% "akka-actor" % AkkaVersion | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package hello_scala | |
import akka.actor.Actor | |
import akka.actor.ActorSystem | |
import akka.actor.Props | |
class HelloActor extends Actor { | |
def receive = { | |
case "hello" => println("hello back to you") | |
case _ => println("huh?") | |
} | |
} | |
object Main extends App { | |
val system = ActorSystem("ReactiveEnterprise") | |
val helloActor = system.actorOf(Props[hello_scala.HelloActor], name = "helloactor") | |
helloActor ! "hello" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment