vertx-sql-client icon indicating copy to clipboard operation
vertx-sql-client copied to clipboard

Design flow in Pool.connectionProvider(): no way to share Pool.closeFuture with the caller so new ConnectionFactory instance is added to it.

Open amkartashov opened this issue 3 years ago • 0 comments

Questions

I'm trying to implement RDS IAM Auth with hibernate-reactive which uses vertx-sql-client pool. Basically, the single thing I need is to update password in connection options on new connection, because it changes every 15 minutes.

I'm using this approach: https://vertx.io/blog/dynamic-db-pool-config-with-sql-client/ - create new factory with MySQLDriver.INSTANCE.createConnectionFactory() for every new connection.

The problem I see is that this new factory differs from default factory created during pool creation - it's not added to pool CloseFuture. This means that this factory won't be closed on pool.close().

I could call factory.close() before creating new factory, but I believe this will close current connections created by old factory.

Mb this can be solved by adding getter method for Pool.closeFuture or by changing connectionProvider so it accepts ConnectionFactory instead.

Version

4.3.2

Extra

Initially I was expecting that it would be possible to call setPassword() method on ConnectionOptions somehow. But Pool does not keep ConnectionFactory and ConnectionOptions; ConnectionFactory keeps ConnectionOptions, but calls it's getPassword() only once in constructor...

What I want is to be able to reuse ConnectionFactory/ConnectionOptions created for the Pool, because it has specific settings defined in Driver implementation like MySQLDriver.newPool()/newPoolImpl()

amkartashov avatar Aug 24 '22 06:08 amkartashov