https://github.com/fgrutsch/akka-persistence-mapdb
akka-persistence-mapdb is a plugin for akka-persistence which uses MapDB for storing journal and snapshot messages
https://github.com/fgrutsch/akka-persistence-mapdb
akka akka-persistence hacktoberfest mapdb persistence-query plugin scala
Last synced: 5 months ago
JSON representation
akka-persistence-mapdb is a plugin for akka-persistence which uses MapDB for storing journal and snapshot messages
- Host: GitHub
- URL: https://github.com/fgrutsch/akka-persistence-mapdb
- Owner: fgrutsch
- Created: 2021-09-29T05:54:33.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-04-24T00:22:27.000Z (about 2 years ago)
- Last Synced: 2024-04-24T01:35:52.086Z (about 2 years ago)
- Topics: akka, akka-persistence, hacktoberfest, mapdb, persistence-query, plugin, scala
- Language: Scala
- Homepage: https://akka-persistence-mapdb.fgrutsch.com
- Size: 396 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# akka-persistence-mapdb
[](https://search.maven.org/search?q=g:%22com.fgrutsch%22%20AND%20a:%22akka-persistence-mapdb_2.13%22)
[](https://github.com/fgrutsch/akka-persistence-mapdb/actions/workflows/ci.yml?query=branch%3Amain)
[](https://codecov.io/gh/fgrutsch/akka-persistence-mapdb)
[](https://opensource.org/licenses/Apache-2.0)
akka-persistence-mapdb is a plugin for [akka-persistence](https://doc.akka.io/docs/akka/current/typed/index-persistence.html) which uses MapDB for storing journal and snapshot messages.
## Getting Started
Add the following dependency to your `build.sbt`:
```scala
libraryDependencies += "com.fgrutsch" %% "akka-persistence-mapdb" % ""
```
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](https://doc.akka.io/docs/akka/current/persistence-query.html) to stream them from the journal. All queries are supported:
```scala
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](https://akka-persistence-mapdb.fgrutsch.com) link.
## Credits
The code of this project is heavily inspired and based on the [akka-persistence-jdbc](https://github.com/akka/akka-persistence-jdbc) backend implementation. Go check it out!
## Contributors
* [Fabian Grutsch](https://github.com/fgrutsch)
## License
This code is licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0.txt).