pekko-persistence-mapdb is a plugin for pekko-persistence which uses MapDB for storing journal and snapshot messages.
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)For the full documentation please check this link.
The code of this project is heavily inspired and based on the akka-persistence-jdbc backend implementation. Go check it out!
This code is licensed under the Apache 2.0 License.