Akka works on memory. However, it is possible to use persistence. Persistence is still kind of experimental in Akka. However, it is stable. For production, you can use advanced persistence plugins, such as Apache Cassandra. For the sake of development and education, we will use Google leveldb in our file system. Akka has multiple persistence options, such as views and persistent Actors.
Let's take a look at a persistent actor using the Google leveldb and file system:
import akka.actor._ import akka.persistence._ import scala.concurrent.duration._ class PersistenceActor extends PersistentActor{ override def persistenceId = "sample-id-1" var state:String = "myState" var count = 0 def receiveCommand: Receive = { case payload: String => println(s"PersistenceActor received ${payload} (nr = ${count})") persist(payload + count) { evt => &...