fgrutsch / akka-persistence-mapdb   0.3.2

Website GitHub

akka-persistence-mapdb is a plugin for akka-persistence which uses MapDB for storing journal and snapshot messages

Scala versions: 3.x 2.13

akka-persistence-mapdb

Maven Github Actions CI Workflow Codecov License

akka-persistence-mapdb is a plugin for akka-persistence which uses MapDB for storing journal and snapshot messages.

Getting Started

Add the following dependency to your build.sbt:

libraryDependencies += "com.fgrutsch" %% "akka-persistence-mapdb" % "<latest>"

Add the following to your application.conf to use akka-persistence-mapdb as the persistence backend:

akka {
  persistence {
    journal {
      plugin = "mapdb-journal"
    }
    snapshot-store {
      plugin = "mapdb-snapshot"
    }
  }
}

This is the minimum required configuration you need to use akka-persistence-mapdb. No further configuration is needed to get it running. Be aware that this by default stores data in memory, check out the full documentation on how to change that.

If you need to query the stored events you can use Persistence Query to stream them from the journal. All queries are supported:

import akka.actor.ActorSystem
import akka.persistence.query.PersistenceQuery
import com.fgrutsch.akka.persistence.mapdb.query.scaladsl.MapDbReadJournal

val actorSystem: ActorSystem = ???
val readJournal: MapDbReadJournal = PersistenceQuery(actorSystem).readJournalFor[MapDbReadJournal](MapDbReadJournal.Identifier)

Documentation

For the full documentation please check this link.

Credits

The code of this project is heavily inspired and based on the akka-persistence-jdbc backend implementation. Go check it out!

Contributors

License

This code is licensed under the Apache 2.0 License.