akkaakka-persistence

Akka Persistence: No Sufficient Working Example for JDBC MySQL


I have been trying to get my EventSourceBehavior to write to MySQL and am getting following error, what could be the issue? Error is very generic and it is hard to see what is the root cause. Is there a way to test wether my JDBC is correctly configured via Akka, ex connectivity etc, Thanks

2020-11-20 00:48:57,999 WAR HikariConfig              slick.db - using dataSourceClassName and ignoring jdbcUrl.
2020-11-20 00:48:57,999 WAR HikariConfig              slick.db - using dataSourceClassName and ignoring jdbcUrl.
2020-11-20 00:48:58,002 INF HikariDataSource          slick.db - Starting...
2020-11-20 00:48:58,002 INF HikariDataSource          slick.db - Starting...
2020-11-20 00:48:58,041 INF HikariDataSource          slick.db - Start completed.
2020-11-20 00:48:58,042 INF HikariDataSource          slick.db - Start completed.
2020-11-20 00:49:18,293 ERR Main$                     Supervisor StopSupervisor saw failure: Exception during recovery from snapshot. PersistenceId [first]. Circuit Breaker Timed out.
akka.persistence.typed.internal.JournalFailureException: Exception during recovery from snapshot. PersistenceId [first]. Circuit Breaker Timed out.

application.conf

akka {
  loglevel = DEBUG

  persistence {
    journal.plugin = "jdbc-journal"
    snapshot-store.plugin = "jdbc-snapshot-store"
  }
}

slick {
  profile = "slick.jdbc.MySQLProfile$"
  db {
    dataSourceClass = "slick.jdbc.DriverDataSource"
    driver = "com.mysql.cj.jdbc.Driver"
    url = "jdbc:mysql://localhost:3306/"
    user = nilu
    password = "password"
  }
}

Solution

  • In general, with Akka Persistence JDBC, you'll need to specify the database to use, not just the DBMS (server) to connect to. So if the DB was called my_akka_persistence, the JDBC URL would be something like jdbc:mysql://localhost:3306/my_akka_persistence.