akkadotnet / Akka.Persistence.EventStore

Akka.Peristence implementation for the EventStore database
Apache License 2.0
16 stars 10 forks source link

Different Journal Instances #17

Closed Zetanova closed 7 months ago

Zetanova commented 4 years ago

It is currently possible to define multiple WriteJournals in the Config but the settings of the default config location are getting loaded. https://github.com/AkkaNetContrib/Akka.Persistence.EventStore/blob/96f58bd8cdc4dac945ded1ef246300c3fb5e10ea/src/Akka.Persistence.EventStore/Journal/EventStoreJournal.cs#L29

The Query/ReadJournal is using the correct owned config, https://github.com/AkkaNetContrib/Akka.Persistence.EventStore/blob/96f58bd8cdc4dac945ded1ef246300c3fb5e10ea/src/Akka.Persistence.EventStore.Query/EventStoreReadJournal.cs#L32-L37

How to let the EventStoreJournal use it's own config section like on the ReadJournal ?

mjaric commented 4 years ago

Hi Zetanova,

You need to set in persistent actor which journal id it should use. Then Actor System will bring it up for you once persistent actor is started

Zetanova commented 4 years ago

@mjaric I load the second EvenStoreReadJournal and it does load the second and correct EvenStoreWriteJournal to take the eventstore connection from it. But as linked above the EventStoreJournal always takes the config from the default hacon-section.

Here is the config and akka.persistence.journal.remote-eventstore takes the config from akka.persistence.journal.eventstore and not it's one section from akka.persistence.journal.remote-eventstore .

akka.persistence {
    journal.remote-eventstore {
        class = "Akka.Persistence.EventStore.Journal.EventStoreJournal, Akka.Persistence.EventStore"
        connection-string = "ConnectTo=tcp://admin:changeit@host.docker.internal:1114;HeartBeatTimeout=500; MaxReconnections=-1; ReconnectionDelay=5000"
        connection-name = "debug"
    }
    query.journal.remote-eventstore {
        class = "Akka.Persistence.EventStore.Query.EventStoreReadJournalProvider, Akka.Persistence.EventStore.Query"
        write-plugin = "akka.persistence.journal.remote-eventstore"
        max-buffer-size = 500
        auto-ack = false
    }
}