Class ReactiveMongoTransactionManager

java.lang.Object
org.springframework.transaction.reactive.AbstractReactiveTransactionManager
org.springframework.data.mongodb.ReactiveMongoTransactionManager
All Implemented Interfaces:
Serializable, InitializingBean, ReactiveTransactionManager, TransactionManager

public class ReactiveMongoTransactionManager extends AbstractReactiveTransactionManager implements InitializingBean
A ReactiveTransactionManager implementation that manages ClientSession based transactions for a single ReactiveMongoDatabaseFactory.
Binds a ClientSession from the specified ReactiveMongoDatabaseFactory to the subscriber Context.
Readonly transactions operate on a ClientSession and enable causal consistency, and also start, commit or abort a transaction.
Application code is required to retrieve the MongoDatabase via ReactiveMongoDatabaseUtils.getDatabase(ReactiveMongoDatabaseFactory) instead of a standard ReactiveMongoDatabaseFactory.getMongoDatabase() call. Spring classes such as ReactiveMongoTemplate use this strategy implicitly.
By default failure of a commit operation raises a TransactionSystemException. You can override doCommit(TransactionSynchronizationManager, ReactiveMongoTransactionObject) to implement the Retry Commit Operation behavior as outlined in the MongoDB reference manual.
Since:
2.2
Author:
Christoph Strobl, Mark Paluch
See Also: