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
When using liquibase-mongodb extension currently it does not reuse the quarkus generated MongoClient.
For example the MongoClientCustomizer have no effects on the mongo clients liquibase use.
This creates some unexpected inconsistencies.
Also quarkus has to rebuild the connection string from the parameters which can create some problems.
Allowing to reuse the quarkus mongo client in the quarkus liquibase extension would allow to fix those issues.
This would also allow to reuse the tls registry settings from #46293.
Implementation ideas
It could be done by implementing a custom MongoClientDriver that injects the quarkus MongoClientsand passing it to liquibase.
For example the following liquibase driver extending MongoClientDriver:
publicclassQuarkusMongoClientDriverextendsMongoClientDriver {
privatestaticfinalLoggerlog = LoggerFactory.getLogger(QuarkusMongoClientDriver.class);
publicMongoClientconnect(ConnectionStringconnectionString) throwsDatabaseException {
try {
Optional<MongoClients> clients = Arc.container().select(MongoClients.class).stream().findFirst();
if (clients.isPresent()) {
log.info("Using quarkus mongo client");
MongoClientsmongoClients = clients.get();
returnmongoClients.createMongoClient(MongoClientBeanUtil.DEFAULT_MONGOCLIENT_NAME);
}
returncom.mongodb.client.MongoClients.create(connectionString);
} catch (Exceptione) {
thrownewDatabaseException(
"Connection could not be established to: " + connectionString.getConnectionString(), e);
}
}
}
This is a simple example that works with the default client.
It works with the JVM quarkus liquibase mongodb integrations tests, but not the native ones some more configuration is needed.
The text was updated successfully, but these errors were encountered:
Description
When using liquibase-mongodb extension currently it does not reuse the quarkus generated
MongoClient
.For example the
MongoClientCustomizer
have no effects on the mongo clients liquibase use.This creates some unexpected inconsistencies.
Also quarkus has to rebuild the connection string from the parameters which can create some problems.
Allowing to reuse the quarkus mongo client in the quarkus liquibase extension would allow to fix those issues.
This would also allow to reuse the tls registry settings from #46293.
Implementation ideas
It could be done by implementing a custom
MongoClientDriver
that injects the quarkusMongoClients
and passing it to liquibase.For example the following liquibase driver extending
MongoClientDriver
:And then using it in the
LiquibaseMongodbFactory
:This is a simple example that works with the default client.
It works with the JVM quarkus liquibase mongodb integrations tests, but not the native ones some more configuration is needed.
The text was updated successfully, but these errors were encountered: