Class MongoDBTransaction
java.lang.Object
com.kingsrook.qqq.backend.core.actions.QBackendTransaction
com.kingsrook.qqq.backend.module.mongodb.actions.MongoDBTransaction
- All Implemented Interfaces:
AutoCloseable
MongoDB implementation of backend transaction.
Stores a mongoClient and clientSession.
Also keeps track of if the specific mongo backend being used supports transactions,
as, it appears that single-node instances do not, and they throw errors if
you try to do transaction operations in them... This is configured by the
corresponding field in the backend metaData.
-
Constructor Summary
ConstructorsConstructorDescriptionMongoDBTransaction
(MongoDBBackendMetaData backend, com.mongodb.client.MongoClient mongoClient) -
Method Summary
Methods inherited from class com.kingsrook.qqq.backend.core.actions.QBackendTransaction
openFor
-
Constructor Details
-
MongoDBTransaction
public MongoDBTransaction(MongoDBBackendMetaData backend, com.mongodb.client.MongoClient mongoClient)
-
-
Method Details
-
commit
Description copied from class:QBackendTransaction
Commit the transaction.- Overrides:
commit
in classQBackendTransaction
- Throws:
QException
-
rollback
Description copied from class:QBackendTransaction
Rollback the transaction.- Overrides:
rollback
in classQBackendTransaction
- Throws:
QException
-
close
public void close()Description copied from class:QBackendTransaction
Close any resources associated with the transaction. In theory, should only be called after a commit or rollback was done.- Specified by:
close
in interfaceAutoCloseable
- Overrides:
close
in classQBackendTransaction
-
getMongoClient
public com.mongodb.client.MongoClient getMongoClient()Getter for mongoClient -
getClientSession
public com.mongodb.client.ClientSession getClientSession()Getter for clientSession
-