Created
December 20, 2017 13:42
-
-
Save diogoaurelio/b469e5c6531e9b9f6b35cb8456292766 to your computer and use it in GitHub Desktop.
Basic Scala Actor Class
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
import akka.actor.Actor | |
import akka.actor.Props | |
import akka.event.Logging | |
class MyActor extends Actor { | |
val log = Logging(context.system, this) | |
var myMutatedVar: Int = 0 | |
def receive = { | |
case "test" => log.info("received test") | |
case "mutate" => myMutatedVar += 1; log.info(s"Mutated var to: $myMutatedVar") | |
case _ => log.info("received unknown message") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment