3

I am trying to use java sdk (java-client v3.4.3). Since I need transactions, I am using transactional flavor of cluster object

cluster.reactive().transactions().run((ctx) -> {});

Both sync/ async versions expect lambda and return

TransactionResult / Mono < TransactionResult >

Since java requires that in a lambda, local variables be final or effectively final, how am I supposed to share the response of say ctx.insert() or ctx.replace() outside this transaction? I want to access the cas value for ctx.insert but I am not able to send data out of this transactions().run() function.

Using global variables does not appear the right choice to me.

Matthew Groves
  • 25,181
  • 9
  • 71
  • 121
uzumas
  • 632
  • 1
  • 8
  • 23
  • 2
    For anyone else who comes along, it looks like this was cross-posted to Couchbase Forum and answered there https://forums.couchbase.com/t/java-sdk-reactive-transactions-responses/35740 – dnault Mar 15 '23 at 17:22

0 Answers0