akka / akka-persistence-jdbc

Asynchronously writes journal and snapshot entries to configured JDBC databases so that Akka Actors can recover state
https://doc.akka.io/docs/akka-persistence-jdbc/
Other
307 stars 139 forks source link

Connecting to multiple databases #249

Open gyoho opened 4 years ago

gyoho commented 4 years ago

Question Does this library support connecting to multiple databases? If so, how?

Background We've been embracing event sourcing with journal systems for years. Our database now have accumulated ~8 million records in the journal table (we take a snapshot every 1000 records). Now, I'm exploring a way to perform database migration from MySQL to Oracle. To do so, I need to have connections to both databases. Is there a way to configure to connect to multiple databases?

WellingR commented 4 years ago

You can copy the jdbc-journal section from https://github.com/dnvriend/akka-persistence-jdbc/blob/master/src/main/resources/reference.conf and you could rename this to e.g. mysql-jdbc-journal. You can then load the plugin based on the mysql-jdbc-journal. This probably means that you must configure which actor uses what journal so I am not sure if that is really what you want.

If you want to write to two journals at the same time, then no, that is not supported.