Add a way for a transactionPublisher to stream uncommitted intermediary output
As discussed in multiple issues, including:
- https://github.com/jOOQ/jOOQ/issues/16401#issuecomment-5598143428
- https://github.com/jOOQ/jOOQ/issues/20114
We're currently exposing inconsistent behaviour of a transactionPublisher whose results are not consumed completely, e.g. by being wrapped in Mono instead of Flux, or by being consumed using Flux::blockFirst.
https://github.com/jOOQ/jOOQ/issues/16401#issuecomment-5598143428 argues and fixes things in a way for a transactionPublisher to be an atomic "unit of work," just like a transactionRunnable (using JDBC) or a transactionCoroutine. Only when the transaction completes with a COMMIT can results be streamed downstream.
In some cases, the previous behaviour may have been desirable, similar to the standard READ UNCOMMITTED transaction isolation, where a transaction's intermediary state can be propagated outside of the transaction.
It should be able for users to opt in to this behaviour, e.g. using Settings or a flag passed to transactionPublisher. If this is implemented, it is important for an incompletely consumed transaction to be consistently rolled back, similar to when we use Flux::blockFirst, which cancels the transactionPublisher, unlike Mono::block, which doesn't!
Source: jOOQ/jOOQ