fgrutsch / pekko-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

pekko-persistence-mapdb

Maven Github Actions CI Workflow Codecov License

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

Getting Started

Add the following dependency to your build.sbt:

libraryDependencies += "io.github.fgrutsch" %% "pekko-persistence-mapdb" % "<latest>"

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

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

This is the minimum required configuration you need to use pekko-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 org.apache.pekko.actor.ActorSystem
import org.apache.pekko.persistence.query.PersistenceQuery
import io.github.fgrutsch.pekko.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.