Interface TxnMeta
-
@Beta public interface TxnMetaAn interface represents the metadata of a transaction inTransactionMetadataStore.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.util.List<TransactionSubscription>ackedPartitions()Return the the list of partitions that this transaction acknowledges to.TxnMetaaddAckedPartitions(java.util.List<TransactionSubscription> subscriptions)Add the list of acked partitions to the transaction.TxnMetaaddProducedPartitions(java.util.List<java.lang.String> partitions)Add the list of produced partitions to the transaction.longgetOpenTimestamp()Return the transaction open timestamp.java.lang.StringgetOwner()Return the transaction's owner.longgetTimeoutAt()Return the transaction timeout at.org.apache.pulsar.client.api.transaction.TxnIDid()Return the transaction id.java.util.List<java.lang.String>producedPartitions()Return the the list of partitions that this transaction produces to.TxnStatusstatus()Return the transaction status.TxnMetaupdateTxnStatus(TxnStatus newStatus, TxnStatus expectedStatus)Update the transaction stats from the newStatus only when the current status is the expected expectedStatus.
-
-
-
Method Detail
-
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
java.util.List<java.lang.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
java.util.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(java.util.List<java.lang.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 inTxnStatus.OPEN
-
addAckedPartitions
TxnMeta addAckedPartitions(java.util.List<TransactionSubscription> subscriptions) throws CoordinatorException.InvalidTxnStatusException
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 inTxnStatus.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 statusexpectedStatus- 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
java.lang.String getOwner()
Return the transaction's owner.- Returns:
- transaction's owner.
-
-