Interface Transaction


public interface Transaction
A Pulsar transaction handle.

Transactions provide exactly-once semantics across multiple topics and subscriptions. Messages produced and acknowledgments made within a transaction are atomically committed or aborted.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Abort this transaction, discarding all produced messages and rolling back acknowledgments.
    Return an asynchronous view of this transaction.
    void
    Commit this transaction, making all produced messages visible and all acknowledgments durable.
    The current state of this transaction.
  • Method Details

    • commit

      void commit() throws PulsarClientException
      Commit this transaction, making all produced messages visible and all acknowledgments durable.
      Throws:
      PulsarClientException - if the transaction cannot be committed (e.g., it has already been aborted, timed out, or encountered an error)
    • abort

      void abort() throws PulsarClientException
      Abort this transaction, discarding all produced messages and rolling back acknowledgments.
      Throws:
      PulsarClientException - if the transaction cannot be aborted (e.g., it has already been committed or encountered an error)
    • async

      Return an asynchronous view of this transaction.
      Returns:
      the AsyncTransaction counterpart of this transaction
    • state

      The current state of this transaction.
      Returns:
      the current Transaction.State of this transaction