Interface TransactionContext


public interface TransactionContext
Provided to source tasks to allow them to define their own producer transaction boundaries when exactly-once support is enabled.
  • Method Details

    • commitTransaction

      void commitTransaction()
      Request a transaction commit after the next batch of records from SourceTask.poll() is processed.
    • commitTransaction

      void commitTransaction(SourceRecord record)
      Request a transaction commit after a source record is processed. The source record will be the last record in the committed transaction.
      Parameters:
      record - the record to commit the transaction after; may not be null.
    • abortTransaction

      void abortTransaction()
      Requests a transaction abort after the next batch of records from SourceTask.poll(). All of the records in that transaction will be discarded and will not appear in a committed transaction. However, offsets for that transaction will still be committed so than the records in that transaction are not reprocessed. If the data should instead be reprocessed, the task should not invoke this method and should instead throw an exception.
    • abortTransaction

      void abortTransaction(SourceRecord record)
      Requests a transaction abort after a source record is processed. The source record will be the last record in the aborted transaction. All of the records in that transaction will be discarded and will not appear in a committed transaction. However, offsets for that transaction will still be committed so that the records in that transaction are not reprocessed. If the data should be reprocessed, the task should not invoke this method and should instead throw an exception.
      Parameters:
      record - the record to abort the transaction after; may not be null.