Interface TxnMeta
@Beta
public interface TxnMeta
An interface represents the metadata of a transaction in
TransactionMetadataStore.-
Method Summary
Modifier and TypeMethodDescriptionReturn the the list of partitions that this transaction acknowledges to.addAckedPartitions(List<TransactionSubscription> subscriptions) Add the list of acked partitions to the transaction.addProducedPartitions(List<String> partitions) Add the list of produced partitions to the transaction.longReturn the transaction open timestamp.getOwner()Return the transaction's owner.longReturn the transaction timeout at.org.apache.pulsar.client.api.transaction.TxnIDid()Return the transaction id.Return the the list of partitions that this transaction produces to.status()Return the transaction status.updateTxnStatus(TxnStatus newStatus, TxnStatus expectedStatus) Update the transaction stats from the newStatus only when the current status is the expected expectedStatus.
-
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
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 inTxnStatus.OPEN
-
addAckedPartitions
TxnMeta addAckedPartitions(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
String getOwner()Return the transaction's owner.- Returns:
- transaction's owner.
-