You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using the Micronaut framework, and I want to override the default HikariCP connection pool, but it is not working. How can we achieve this?
Alternatively, how can we close the default HikariCP connection pool in this framework? we have Implemented multi-tenancy and we have created Custom Hikari Cp for that !!
The logging isn't functioning.
Micronaut version :- 3.7.4
database : PostgreSQl
Here is The Custom HikariCp for multi-tenancy Code
public DataSource createAndConfigureDataSource(String tenantName, String username, String password){
logger.info ("Creating a new DataSource for tenant "+tenantName );
HikariDataSource ds = new HikariDataSource();
ds.setUsername(username);
ds.setPassword(password);
ds.setJdbcUrl(MultiTenantConnectionProvider.DEFAULT_URL+tenantName) ;
ds.setDriverClassName("org.postgresql.Driver");
ds.setConnectionTimeout(20000);
// Minimum number of idle connections in the pool
ds.setMinimumIdle(2);
// Maximum number of actual connection in the pool
ds.setMaximumPoolSize(15);
ds.setSchema("public");
// Maximum time that a connection is allowed to sit idle in the pool
ds.setIdleTimeout(300000);
ds.setLeakDetectionThreshold(2100);
ds.setConnectionTimeout(20000);
// Setting up a pool name for each tenant datasource
String tenantConnectionPoolName = tenantName + " -connection-pool";
ds.setPoolName(tenantConnectionPoolName);
return ds;
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Problem Statement
Micronaut version :- 3.7.4
database : PostgreSQl
Here is The Custom HikariCp for multi-tenancy Code
Here is application.yml file code
Beta Was this translation helpful? Give feedback.
All reactions