Accessing Couchbase Transaction response outside lambda

65 views Asked by At

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.

0

There are 0 answers