Skip to content

Instantly share code, notes, and snippets.

@Slesa
Created December 5, 2020 22:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Slesa/7a59f5593c142a70234d21348ac27fef to your computer and use it in GitHub Desktop.
Save Slesa/7a59f5593c142a70234d21348ac27fef to your computer and use it in GitHub Desktop.
Scala Hello World
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
)
)
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