2

I am wanting to use non-blocking r2dbc without 'using a third party reactive stream API', and currently have this working when I configure the DSLContext with JDBC (ie. all the records are printed):

     // appended to a jOOQ select query
     .fetchAsync()
     .thenApply{ it.map(mapping(::Film)) }
     .whenComplete { result, _ -> println( result ) }

however, if I configure the DSLContext to use r2dbc (without any other changes), the println( result ) prints null :-(

I:

  • am using Kotlin, but not bridging to coroutines yet ... only the above calls are involved
  • am using io.r2dbc:r2dbc-mssql:0.8.6.RELEASE
  • don't know if r2dbc is 'working' in any sense ... I'm relying on jOOQ to hit me with an exception if not ... I've not seen a single piece of data relayed by r2dbc at this stage.
David Bullock
  • 6,112
  • 3
  • 33
  • 43

1 Answers1

0

As of jOOQ 3.15.1, this isn't possible yet, see https://github.com/jOOQ/jOOQ/issues/11717. It's likely this will be fixed in a 3.15.x patch release

Lukas Eder
  • 211,314
  • 129
  • 689
  • 1,509
  • 1
    OK, since r2dbc hasn't yet achieved a release that's mature/complete, I guess we'll let you have a little more time to fine-tune things :-) . Meanwhile, I am grateful to have jOOQ as an abstraction layer between me and the database-connectivity plumbing, and I can easily write my code in a reactive style *now* even though, because of JDBC, the thread does in fact block on I/O. – David Bullock Aug 25 '21 at 00:30
  • @DavidBullock yeah it's all bleeding edge – Lukas Eder Aug 25 '21 at 04:40
  • Yep. More like driving a rocket while you're on the tip of the rocket, holding on for dear life and hoping the rocket doesn't smash into something. I think we're called 'thrillseekers'?! Other names spring to mind ... – David Bullock Aug 25 '21 at 04:45
  • @DavidBullock: blocking, synchronous code is probably fine, too ;-) – Lukas Eder Aug 25 '21 at 06:34
  • I just discovered [kotlinx-coroutines-jdk9](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-jdk9/kotlinx.coroutines.jdk9/index.html) which bridges co-routines to a `java.util.concurrent.Flow`. Can I get reactive with jOOQ and r2dbc using this pathway? (I have a bit more reading to do before I try). – David Bullock Aug 26 '21 at 03:34
  • jOOQ supports the Flow API as well as its Java 8 predecesdpr reactive streams. It might work. I'll do some experiments in that direction, myself, soon – Lukas Eder Aug 26 '21 at 10:19