Package io.camunda.zeebe.db
Interface TransactionContext
- All Known Implementing Classes:
DefaultTransactionContext
public interface TransactionContext
Represents the transaction context to interact with the database in a transaction.
-
Method Summary
Modifier and TypeMethodDescriptionThis will return an transaction object, on which the caller can operate on.voidrunInTransaction(TransactionOperation operations) Runs the commands like delete, put etc.
-
Method Details
-
runInTransaction
Runs the commands like delete, put etc. in a transaction. Access of different column families inside this transaction are possible.Reading key-value pairs via get or an iterator is also possible and will reflect changes, which are made during the transaction.
NOTE: It is allowed to nest these calls. The transaction will then be reused (it will run in the same transaction). If the outer call ends, the transaction will be committed. On an error the transaction is rolled back.
- Parameters:
operations- the operations- Throws:
ZeebeDbException- is thrown on an unexpected error in the database layerRuntimeException- is thrown on an unexpected error in executing the operations
-
getCurrentTransaction
ZeebeDbTransaction getCurrentTransaction()This will return an transaction object, on which the caller can operate on. The caller is free to decide when to commit or rollback the transaction.- Returns:
- the transaction object
-