Kirill Kazoolin
Kirill Kazoolin

Reputation: 263

How do I create JOOQ DSLContext from reactive MariaDB connection

JOOQ manual states the following:

Out of the box, all jOOQ provided publishers will block on the underlying JDBC connection, but if you provide jOOQ with a io.r2dbc.spi.Connection or io.r2dbc.spi.ConnectionFactory, then the publishers will execute queries in a non-blocking fashion on an R2DBC driver.

How do I provide DSLContext with io.r2dbc.spi.Connection or io.r2dbc.spi.ConnectionFactory ?

I tried DSL.using() but it does not accept this interface.

Also - can I define the DSLContext with reactive driver through Spring Boot ?

Thank you.

Upvotes: 3

Views: 740

Answers (1)

Lukas Eder
Lukas Eder

Reputation: 221145

How do I provide DSLContext with io.r2dbc.spi.Connection or io.r2dbc.spi.ConnectionFactory ?

At the time of this question, jOOQ 3.14 did not yet support R2DBC. With jOOQ 3.15, you can write this:

DSLContext ctx1 = DSL.using(connection);
DSLContext ctx2 = DSL.using(connectionFactory);

Just like with JDBC connections.

Also - can I define the DSLContext with reactive driver through Spring Boot ?

I suspect that this will be possible once jOOQ 3.15 is released (~ end of Q2 2021, no promises). Until then, just expose a @Bean of type DSLContext that you build manually from an injected ConnectionFactory

Upvotes: 4

Related Questions