Hello friends,
I must create a separate jdbc persistent store for each customer (Multi-tenancy). And I need to resolve this during runtime. I am OK with embedding the customer code in persistentId (e.g. ABCCustomer_orders_actor) and using the substring to resolve the respective db connection.
One closest option seems to be Customized loading of the db connection SlickDatabaseProvider. But it does not seem to be helpful, but only config is available from the abstract database method. I think this is called only once during init, so not suitable?
class CustomDatabaseProvider extends SlickDatabaseProvider {
override def database(config: Config): SlickDatabase = {
//My requirement: resolve the respective database of the customer.
}
}
Is there any other way I can solve this problem?
Appreciate any kind help.
MK