Interface TxnMeta


@Beta public interface TxnMeta
An interface represents the metadata of a transaction in TransactionMetadataStore.
  • Method Details

    • id

      org.apache.pulsar.client.api.transaction.TxnID id()
      Return the transaction id.
      Returns:
      transaction id.
    • status

      TxnStatus status()
      Return the transaction status.
      Returns:
      transaction status.
    • producedPartitions

      List<String> producedPartitions()
      Return the the list of partitions that this transaction produces to.
      Returns:
      the list of partitions that this transaction produced to. the returned list is sorted by partition name.
    • ackedPartitions

      List<TransactionSubscription> ackedPartitions()
      Return the the list of partitions that this transaction acknowledges to.
      Returns:
      the list of partitions that this transaction acknowledges to. the returned list is sorted by partition name.
    • addProducedPartitions

      TxnMeta addProducedPartitions(List<String> partitions) throws CoordinatorException.InvalidTxnStatusException
      Add the list of produced partitions to the transaction.
      Returns:
      transaction meta
      Throws:
      CoordinatorException.InvalidTxnStatusException - if the transaction is not in TxnStatus.OPEN
    • addAckedPartitions

      Add the list of acked partitions to the transaction.
      Parameters:
      subscriptions - the ackd subscriptions add to the transaction
      Returns:
      transaction meta
      Throws:
      CoordinatorException.InvalidTxnStatusException - if the transaction is not in TxnStatus.OPEN
    • updateTxnStatus

      TxnMeta updateTxnStatus(TxnStatus newStatus, TxnStatus expectedStatus) throws CoordinatorException.InvalidTxnStatusException
      Update the transaction stats from the newStatus only when the current status is the expected expectedStatus.
      Parameters:
      newStatus - the new transaction status
      expectedStatus - the expected transaction status
      Returns:
      the transaction itself.
      Throws:
      CoordinatorException.InvalidTxnStatusException - if the transaction is not in the expected status, or it can not be transitioned to the new status
    • getOpenTimestamp

      long getOpenTimestamp()
      Return the transaction open timestamp.
      Returns:
      transaction open timestamp.
    • getTimeoutAt

      long getTimeoutAt()
      Return the transaction timeout at.
      Returns:
      transaction timeout at.
    • getOwner

      String getOwner()
      Return the transaction's owner.
      Returns:
      transaction's owner.