Does Spring's support for RDBMS transaction management also work in Spring WebFlux?
For example, assuming proper configuration, will a method annotated with the @Transactional
annotation use the Spring transaction manager and rollback the transaction if an error occurs?
If transaction management does work, must a @Transactional
method actually throw
and exception, or must the Mono
or Flux
return type emit an error signal?
I know JDBC is inherently blocking, and thus any JDBC operations must be bridged from blocking to reactive, or vice-versa.
The Spring transaction manager works by using a ThreadLocal
(right?) which I'm assuming won't work in a Reactor environment, since Reactor is frugal with threads and a single thread can swap out one unit of work for another while the first is waiting on I/O. I know Reactor has the Context
object which is conceptually similar to ThreadLocal
(right?) but I haven't seen any documentation that mentions that transaction makes use of it. Additionally, all JDBC operations that occur within a transaction must use the same Connection
which might be tough to do in a reactive context.
My organization has experience with WebFlux and Cassandra, but Cassandra has a native reactive driver.
Thank you!