How to use Akka Persistence JDBC plugin 5.0.1 with Lagom 1.6.5?

Hi,
I see that version 5.0.1. of Akka Persistence JDBC plugin is available and I have tried to use it in my Lagom project. I use Lagom 1.6.5.

I have tried this so far:

build.sbt:

val AkkaVersion = "2.6.10"
val SlickVersion = "3.3.3"

lazy val `myproj-impl` = (project in file("myproj-impl"))
...
   .settings(
       libraryDependencies ++= Seq(
        ...
         "com.lightbend.akka" %% "akka-persistence-jdbc" % "5.0.1",
         "com.typesafe.akka" %% "akka-persistence-query" % AkkaVersion,
         "com.typesafe.slick" %% "slick" % SlickVersion,
         "com.typesafe.slick" %% "slick-hikaricp" % SlickVersion
        ...
   )
)

application.conf:

akka {
  persistence {
    journal {
      plugin = "jdbc-journal"
      // Enable the line below to automatically start the journal when the actorsystem is started
      // auto-start-journals = ["jdbc-journal"]
    }
    snapshot-store {
      plugin = "jdbc-snapshot-store"
      // Enable the line below to automatically start the snapshot-store when the actorsystem is started
      // auto-start-snapshot-stores = ["jdbc-snapshot-store"]
    }
  }
}

jdbc-journal {
  slick = ${slick}
}

# the akka-persistence-snapshot-store in use
jdbc-snapshot-store {
  slick = ${slick}
}

# the akka-persistence-query provider in use
jdbc-read-journal {
  slick = ${slick}
}

slick {
  profile = "slick.jdbc.PostgresProfile$"
  db {
    host = "localhost"
    host = ${?DB_HOST}
    url = "jdbc:postgresql://"${slick.db.host}":5432/mydb"
    user = "someuser"
    password = "somepassword"
    driver = "org.postgresql.Driver"
    numThreads = 5
    maxConnections = 5
    minConnections = 1
  }
}

But this does not work.

An error message raised that db.default still needs to be configured and I do not know why. The url, driver, user and password is then configured twice (once in db.default and second in slick ).

Then another error raised:

java.lang.NoSuchMethodError: 'com.typesafe.config.Config akka.persistence.jdbc.util.ConfigOps$ConfigOperations$.asConfig$default$2$extension(com.typesafe.config.Config)'

It seems that an older version of typesafe.config.Config is in the classpath.

Please, what is the proper way to configure use of Akka Persistence JDBC Plugin v 5.0.1?

Thank you very much for any hints.
Ales

Hi @ignasi35,
I am very sorry to bother you with this but it seems there are not too much people who understand this :-)

Could you please point me to the right direction, where to start?

Thank you very much in advance
Ales

I was under the impression you’d want to use lagom’s persistence component instead of akka’s explicitly, at least according to the docs Lagom - Relational Database Setup

Is there a reason why you’re wanting to use a different version explicitly?

Hi,
there is a known issue in the Lagom’s Akka Persistence JDBC. It stores the data in a binary format and not the Json text (for example the bug is not present in the Cassandra Persistence component, but we use JDBC). See the original discussion in Akka Typed Persistence - is the message format correct?.
Ales

So, I just started the process of trying this out, and it appears that it’s Lagom’s persistence module that is the one at fault, it is attempting to set up the persistence layer for lagom’s persistent entities and because it was built against Akka-persistence 3.x it’s no longer compatible with akka-persistnce 5.x.

The result is basically a heavy handed migration at excluding the lagom persistence modules in play.modules.disabled and configuring Slick yourself (you’d have to set up the slick provider like Lagom does)
and likely set up


akka.persistence.journal.plugin = jdbc-journal
akka.persistence.snapshot-store.plugin = jdbc-snapshot-store

to be something different.

It does appear though that update efforts are stymied by awaiting Play 2.9 update to come out before Akka can be updated (and therefor the persistence portion). I’m personally not going to be waiting for such an update and looking at migrating to pure Akka overall.