Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reactive transaction management support #22590

Closed
jhoeller opened this issue Mar 13, 2019 · 3 comments
Closed

Reactive transaction management support #22590

jhoeller opened this issue Mar 13, 2019 · 3 comments
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@jhoeller
Copy link
Contributor

Since we have two cases in Spring Data already where transactions are supported with reactive drivers - namely for MongoDB and R2DBC -, let's revisit our core transaction management abstraction and our @Transactional support for reactive scenarios.

The transaction interceptor could automatically detect reactive scenarios through a Publisher return type from the method it is supposed to proxy and automatically go through a reactive transaction management SPI in that case. Such an SPI has been prototyped for MongoDB and R2DBC already, so it's mostly a matter of rolling it into Spring Framework proper.

Configuration-wise, the existing transaction configuration elements would largely still apply, just pointing to a reactive transaction manager implementation instead of a classic PlatformTransactionManager.

@jhoeller jhoeller added in: core Issues in core modules (aop, beans, core, context, expression) type: enhancement A general enhancement labels Mar 13, 2019
@jhoeller jhoeller added this to the 5.2 M1 milestone Mar 13, 2019
@jhoeller jhoeller self-assigned this Mar 13, 2019
@sbrannen sbrannen added the in: data Issues in data modules (jdbc, orm, oxm, tx) label Mar 23, 2019
@jhoeller jhoeller changed the title Reactive transaction management SPI Reactive transaction management support Mar 23, 2019
@jhoeller jhoeller removed the in: core Issues in core modules (aop, beans, core, context, expression) label Mar 23, 2019
@jhoeller jhoeller modified the milestones: 5.2 M1, 5.2 M2 Mar 27, 2019
@jhoeller
Copy link
Contributor Author

jhoeller commented May 2, 2019

I've baked this into TransactionAspectSupport directly, as inner classes that are conditionally used when a Publisher-based method is discovered. A transaction manager can now be configured as a TransactionManager marker interface, automatically cast to PlatformTransactionManager or ReactiveTransactionManager as needed.

@bdeneuter
Copy link

bdeneuter commented Nov 4, 2019

We are trying to upgrade to spring-boot 2.2/Spring 5.2. We are using the reactive WebClient in combination with plain JDBC (we are using Aurora MySQL). This means we have reactor on the classpath. After upgrading we receive the following error: java.lang.IllegalStateException: Specified transaction manager is not a ReactiveTransactionManager. What is the path we need to follow to upgrade in the case where @transactional is used and reactive streams is on the classpath? Or should I create a bug ticket?

@sbrannen
Copy link
Member

sbrannen commented Nov 4, 2019

@bdeneuter, your question sounds like it may have already been covered by #23832.

Can you please try out Spring Framework 5.2.1?

Also, please refrain from asking questions on closed issues. If you encounter a regression, please open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants