Is there a way to do a clean shutdown of an R2dbc ...
# komapper
d
Is there a way to do a clean shutdown of an R2dbc connection pool that was was passed as a
ConnectionFactory
in
R2dbcDatabase(...)
? Like when shutting down a Ktor server in Kubernetes, will all the connections be closed automatically? Otherwise, I'd need some kind of
close()
to clean them up on
SIGTERM
or
SIGINT
.
t
Komapper does not close pooled connections automatically. Do you use r2dbc-pool? This method may be helpful to you. https://github.com/r2dbc/r2dbc-pool/blob/v1.0.0.RELEASE/src/main/java/io/r2dbc/pool/ConnectionPool.java#L308
d
Yeah, but there's no constructor in komapper that allows me to pass an instance of the pool.. I can only pass a connection factory and let komapper handle it...
So I don't have access to that method
t
io.r2dbc.pool.ConnectionPool
is the subtype of
io.r2dbc.spi.ConnectionFactory
. So you can pass it to the R2dbcDatabase constructor. The
ConnectionFactory
managed by Komapper will be made available in the next version. https://github.com/komapper/komapper/pull/894
d
Will this be released soon? Thanks 😃!
t
Yes, we are releasing it this weekend.
174 Views