Configuration

Below you can see the reference.conf that ships with this library and all its related configuration settings that you may want to override.

The most important setting for you is most likely the storage mode (akka-persistence-mapdb.db.mode).

sourceakka-persistence-mapdb {
  
  db {
    # The MapDB storage mode. Available modes:
    #   "memory":    data is stored in memory and not available after JVM shutdown/restart
    #   "file":      data is stored in a file and available after JVM shutdown/restart
    #   "temp-file": data is stored in a temporary file and not available after JVM shutdown/restart
    mode = "memory"

    # Whether to enable MapDB's transactions and crash protection (https://jankotek.gitbooks.io/mapdb/content/performance/#transactions-and-crash-protection)
    transaction-enable = true

    # Whether to close the MapDB connection on JVM shutdown
    close-on-jvm-shutdown = true

    # Customization settings if you use the "file" mode
    file {
      # A valid Java Path to be used as the storage location
      path = "akka-persistence-mapdb_default"

      # Whether to delete the file after closing the MapDB connection (useful for testing)
      delete-after-close = false
    }
  }

}

mapdb-journal {
  class = "com.fgrutsch.akka.persistence.mapdb.journal.MapDbJournal"

  db {
    # The name that identifies the journal within MapDB's DB object
    name = "journal"

    commit-required = ${akka-persistence-mapdb.db.transaction-enable}
  }
}

mapdb-snapshot {
  class = "com.fgrutsch.akka.persistence.mapdb.snapshot.MapDbSnapshotStore"

  db {
    # The name that identifies the snapshot within MapDB's DB object
    name = "snapshot"

    commit-required = ${akka-persistence-mapdb.db.transaction-enable}
  }
}

mapdb-read-journal {
  class = "com.fgrutsch.akka.persistence.mapdb.query.MapDbReadJournalProvider"
  
  # Path to the journal configuration. Read journal uses event adapters from the write plugin when reading messages.
  write-plugin = "mapdb-journal"

  # New events are polled with this interval
  refresh-interval = "1s"

  # How many events to fetch in one read query
  max-buffer-size = 100000

  db {
    # The name that identifies the related write journal within MapDB's DB object
    name = ${mapdb-journal.db.name}
  }
}
The source code for this page can be found here.