akkadotnet/Akka.Persistence.MongoDB

I can't find my snapshot store but everything is working

ImCarrot opened this issue · 3 comments

Hi I am working with akka.Persistence with Mongo, below is my HOCON

 <akka>
    <hocon>
      <![CDATA[
  
    akka {
      loglevel = INFO
      }
      
      akka.persistence {
          journal {
          plugin = "akka.persistence.journal.mongodb"
	          mongodb {
		          # qualified type name of the MongoDb persistence journal actor
		          class = "Akka.Persistence.MongoDb.Journal.MongoDbJournal, Akka.Persistence.MongoDb"

		          # connection string used for database access
		          connection-string = "mongodb://127.0.0.1:27017/akkaPersistence"

		          # should corresponding journal table's indexes be initialized automatically
		          auto-initialize = on

		          # dispatcher used to drive journal actor
		          plugin-dispatcher = "akka.actor.default-dispatcher"

		          # MongoDb collection corresponding with persistent journal
		          collection = "EventJournal"

		          # metadata collection
		          metadata-collection = "Metadata"
	          }
          }

          snapshot-store {
	          mongodb {
		          # qualified type name of the MongoDB persistence snapshot actor
		          class = "Akka.Persistence.MongoDb.Snapshot.MongoDbSnapshotStore, Akka.Persistence.MongoDb"

		          # connection string used for database access
		          connection-string = "mongodb://127.0.0.1:27017/akkaPersistence"

		          # should corresponding snapshot's indexes be initialized automatically
		          auto-initialize = on

		          # dispatcher used to drive snapshot storage actor
		          plugin-dispatcher = "akka.actor.default-dispatcher"

		          # MongoDb collection corresponding with persistent snapshot store
		          collection = "akkaShots"
	          }
          }
      }
    }      
  
  ]]>
</hocon>

What's interesting is I checked my database, there is no collection that holds the snapshots. But everything works just fine. I restarted my system and still no collection yet snapshots get restored (so no in-memory, I know restarting the console would have worked too, but I thought it's my database that's not showing it to me).

I have the collection that holds the EventJournal, I am curious as to where are the snapshots restored from.

I am using

SaveSnapshot(actorState);  // to store the state
Recover<SnapshotOffer>(x=> {..});  // to restore

A default snapshot store stores snapshots as files under ./snapshot directory.

@Horusiath Ahh, on the windows file system that'll be in users? Next thing, what's wrong with my HOCON? why isn't it using mongo when the journal works just fine.

@ImCarrot you've specified akka.persistence.journal.plugin = akka.persistence.journal.mongodb correctly, but you haven't done the same for snapshot. You need akka.persistence.snapshot-store.plugin = akka.persistence.snapshot-store.mongo in your HOCON config.