I have akka microservice, for DB I use config like:
companyname.db {
profile = "slick.jdbc.MySQLProfile$"
db {
driver = "org.mariadb.jdbc.Driver"
url = "jdbc:mysql://127.0.0.1:1234"
user = "root"
password = "password"
password = ${?DB_PASSWORD}
connectionPool = "HikariCP"
numThreads = 20
minConnections = 10
maxConnections = 20
connectionTestQuery = "SELECT 1"
idleTimeout = 0
maxLifetime = 595000
keepAliveConnection = true
}
}
I have also standard, simple journal config:
akka {
persistence {
journal {
plugin = "jdbc-journal"
}
snapshot-store {
plugin = "jdbc-snapshot-store"
}
}
}
jdbc-journal = {
slick = ${abaro.opt.db}
bufferSize = 5000
}
jdbc-snapshot-store = {
slick = ${abaro.opt.db}
}
jdbc-read-journal = {
slick = ${abaro.opt.db}
}
and from logs, also by checking VisualVM and by quering information_schema.processlist I see that 2 connection pools are created.
I want to change journal to use this main db pool from config, that other code is using.
Is it possible ?
thanks
Sharing a single connection pool is covered with an example config in the akka-persistence-jdbc docs here: https://doc.akka.io/docs/akka-persistence-jdbc/current/configuration.html#sharing-the-database-connection-pool-between-the-journals