Interface TransactionContext

All Known Implementing Classes:
DefaultTransactionContext

public interface TransactionContext
Represents the transaction context to interact with the database in a transaction.
  • Method Details

    • runInTransaction

      void runInTransaction(TransactionOperation operations)
      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 layer
      RuntimeException - 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