This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.
Applies to ✅ Open Source Edition ✅ Express Edition ✅ Professional Edition ✅ Enterprise Edition
In a reactive programming model, a query will not be executed eagerly and blocking the current thread. Instead a query implements a
Publisher API, such as JDK 9's
java.util.concurrent.Flow.Publisher or the Reactive Streams
When using a third party reactive stream API like project reactor, jOOQ queries can easily be embedded in a
Mono type, such as:
List<String> authors = Flux.from(create.select(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME) .from(AUTHOR)) .map(r -> r.get(AUTHOR.FIRST_NAME) + " " + r.get(AUTHOR.LAST_NAME)) .collectList() .block();
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.ConnectionFactory, then the publishers will execute queries in a non-blocking fashion on an R2DBC driver.