use of keywhiz.JooqHealthCheck in project keywhiz by square.
the class ServiceDataSourceModule method readonlyDataSource.
@Provides
@Singleton
@Readonly
ManagedDataSource readonlyDataSource(Environment environment, KeywhizConfig config) {
DataSourceFactory dataSourceFactory = config.getReadonlyDataSourceFactory();
ManagedDataSource dataSource = dataSourceFactory.build(environment.metrics(), "db-readonly");
environment.lifecycle().manage(dataSource);
environment.healthChecks().register("db-readonly-health", new JooqHealthCheck(dataSource, RETURN_UNHEALTHY));
return dataSource;
}
use of keywhiz.JooqHealthCheck in project keywhiz by square.
the class ServiceDataSourceModule method dataSource.
@Provides
@Singleton
ManagedDataSource dataSource(Environment environment, KeywhizConfig config) {
DataSourceFactory dataSourceFactory = config.getDataSourceFactory();
ManagedDataSource dataSource = dataSourceFactory.build(environment.metrics(), "db-writable");
environment.lifecycle().manage(dataSource);
environment.healthChecks().register("db-read-write-health", new JooqHealthCheck(dataSource, LOG_ONLY));
return dataSource;
}
Aggregations