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
308 stars 142 forks source link

durable_state.schemaName is ignored #657

Open kam-dev-35 opened 2 years ago

kam-dev-35 commented 2 years ago

Versions used

Akka version: 2.6.19

Expected Behavior

jdbc-durable-state-store { use-shared-db = "slick"

tables { durable_state { tableName = "durable_state" schemaName = "strategy_service" } } }

I have a schema per microservice. And I'd like to use specific schema - "strategy_service"

Actual Behavior

Schema name is ignored. org.postgresql.util.PSQLException: ERROR: relation "durable_state" does not exist. If I create table in "public" everything works well.

Relevant logs

akka.persistence.typed.state.internal.DurableStateStoreException: Failed to persist state with sequence number [1] for persistenceId [Subscription|39349933-d95d-4761-8083-b212442150f1] Caused by: org.postgresql.util.PSQLException: ERROR: relation "durable_state" does not exist

Reproducible Test Case

application.conf: akka { persistence { state { plugin = "jdbc-durable-state-store"

Enable the line below to automatically start the snapshot-store when the actorsystem is started

  # auto-start-snapshot-stores = ["jdbc-snapshot-store"]
}

} }

akka-persistence-jdbc { shared-databases { slick = ${slick.dbs.default} } }

jdbc-durable-state-store { use-shared-db = "slick"

tables { durable_state { tableName = "durable_state" schemaName = "strategy_service" } } }

build.sbt: val akkaVersion = "2.6.19"

libraryDependencies ++= Seq( ws, "com.typesafe.akka" %% "akka-stream-kafka" % "3.0.0", "org.postgresql" % "postgresql" % "42.3.4", "com.typesafe.play" %% "play-slick" % "5.0.2", "com.lightbend.akka.management" %% "akka-management-cluster-http" % "1.1.3", "com.lightbend.akka.management" %% "akka-management-cluster-bootstrap" % "1.1.3", "com.typesafe.akka" %% "akka-discovery" % akkaVersion, "com.lightbend.akka.discovery" %% "akka-discovery-kubernetes-api" % "1.1.3", clusterSharding, "com.typesafe.akka" %% "akka-persistence-typed" % akkaVersion, "com.typesafe.akka" %% "akka-persistence-query" % akkaVersion, "com.lightbend.akka" %% "akka-persistence-jdbc" % "5.0.4" )

patriknw commented 2 years ago

@kam-dev-35 Thanks for reporting. Would you be able to create a pull request fixing the issue?