Open jroper opened 4 years ago
That makes sense and we should have thought about it earlier.
It also makes me think about shutdown ordering. I think it's a problem that it's not entirely solved in Lagom as the pool can be closed while the read-side are still trying to use it.
SlickProjection
currently requires passing a SlickDatabaseConfig
object, which is a class designed for use with Slick when configuring Slick in a stand alone manner using Slicks own configuration mechanism in typesafe config. If you're using Slick in the context of something else that manages Slick configuration and connections for you, for example, if you're usingakka-persistence-jdbc
, which defines an Akka extension that loads configuration and configures Slick so that many things (journal, snapshot, persistence query etc) can share the same configuration and connection pools, or if you're using Play that likewise supplies similar APIs, you won't have aDatabaseConfig
that you can pass toSlickProjection
, and your only option will be to instantiate one yourself from scratch, which will require duplicating the Slick configuration in your config files (connection urls, database driver fqcns, username/password etc), and will also result in multiple connection pools for the same database being created, which the user will then have to shut down themselves instead of being able to rely on the framework supplied mechanism to shut it down.SlickProjection
should therefore not require passing aDatabaseConfig
, but should be overloaded to allow passing a SlickProfile
andDatabase
instance instead.