/akka-persistence-protobuf-example

Example for using Akka Persistent FSM with Protobuf and ScalaPB

Primary LanguageScala

Akka Persistence with Protobuf

This example uses

Getting started

  • sbt test

Running in the console

sbt> console
scala> import akka.actor.{ActorRef, ActorSystem, Props}
scala> import ranked.GameProtocol.Team._
scala> import ranked.GameProtocol._
scala> import ranked._
scala> val system = ActorSystem("TestSystem")
scala> val game: ActorRef = system.actorOf(Props[Game], "game1")

scala> game ! StartGame()
scala> game ! NewGoal(TEAM_A)
scala> game ! NewGoal(TEAM_B)

scala> system.terminate()
scala> :quit
sbt> console

scala> import akka.actor.{ActorRef, ActorSystem, Props}
scala> import ranked.GameProtocol.Team._
scala> import ranked.GameProtocol._
scala> import ranked._
scala> val system = ActorSystem("TestSystem")
scala> val game: ActorRef = system.actorOf(Props[Game], "game1")
[INFO] Recovery completed!

scala> scala> game ! GetScore()
[INFO] Score: Team A has 1 goals and Team B has 1 goals.