Interface TransactionCoordinatorClient
- All Superinterfaces:
AutoCloseable
,Closeable
Transaction coordinator client.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enum
State of the transaction coordinator client. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final long
Default transaction ttl in mills. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Abort txn.abortAsync
(TxnID txnID) Abort txn asynchronously.void
addPublishPartitionToTxn
(TxnID txnID, List<String> partitions) Add publish partition to txn.addPublishPartitionToTxnAsync
(TxnID txnID, List<String> partitions) Add publish partition to txn asynchronously.void
addSubscriptionToTxn
(TxnID txnID, String topic, String subscription) Add ack subscription to txn.addSubscriptionToTxnAsync
(TxnID txnID, String topic, String subscription) Add ack subscription to txn asynchronously.Close the transaction meta store client asynchronous.void
Commit txn.commitAsync
(TxnID txnID) Commit txn asynchronously.getState()
Get current state of the transaction meta store.Create a new transaction.newTransaction
(long timeout, TimeUnit unit) Create a new transaction.Create a new transaction asynchronously.newTransactionAsync
(long timeout, TimeUnit unit) Create a new transaction asynchronously.void
start()
Start transaction meta store client.Start transaction meta store client asynchronous.
-
Field Details
-
DEFAULT_TXN_TTL_MS
static final long DEFAULT_TXN_TTL_MSDefault transaction ttl in mills.- See Also:
-
-
Method Details
-
start
Start transaction meta store client.This will create connections to transaction meta store service.
- Throws:
TransactionCoordinatorClientException
- exception occur while start
-
startAsync
CompletableFuture<Void> startAsync()Start transaction meta store client asynchronous.This will create connections to transaction meta store service.
- Returns:
- a future represents the result of start transaction meta store
-
closeAsync
CompletableFuture<Void> closeAsync()Close the transaction meta store client asynchronous.- Returns:
- a future represents the result of close transaction meta store
-
newTransaction
Create a new transaction.- Returns:
TxnID
as the identifier for identifying the transaction.- Throws:
TransactionCoordinatorClientException
-
newTransactionAsync
CompletableFuture<TxnID> newTransactionAsync()Create a new transaction asynchronously.- Returns:
- a future represents the result of creating a new transaction.
it returns
TxnID
as the identifier for identifying the transaction.
-
newTransaction
Create a new transaction.- Parameters:
timeout
- timeout for new transactionunit
- time unit for new transaction- Returns:
TxnID
as the identifier for identifying the transaction.- Throws:
TransactionCoordinatorClientException
-
newTransactionAsync
Create a new transaction asynchronously.- Parameters:
timeout
- timeout for new transactionunit
- time unit for new transaction- Returns:
- a future represents the result of creating a new transaction.
it returns
TxnID
as the identifier for identifying the transaction.
-
addPublishPartitionToTxn
void addPublishPartitionToTxn(TxnID txnID, List<String> partitions) throws TransactionCoordinatorClientException Add publish partition to txn.- Parameters:
txnID
- txn id which add partitions to.partitions
- partitions add to the txn.- Throws:
TransactionCoordinatorClientException
-
addPublishPartitionToTxnAsync
Add publish partition to txn asynchronously.- Parameters:
txnID
- txn id which add partitions to.partitions
- partitions add to the txn.- Returns:
- a future represents the result of add publish partition to txn.
-
addSubscriptionToTxn
void addSubscriptionToTxn(TxnID txnID, String topic, String subscription) throws TransactionCoordinatorClientException Add ack subscription to txn.- Parameters:
txnID
- transaction idtopic
- topic namesubscription
- subscription name- Throws:
TransactionCoordinatorClientException
- while transaction is conflict
-
addSubscriptionToTxnAsync
Add ack subscription to txn asynchronously.- Parameters:
txnID
- transaction idtopic
- topic namesubscription
- subscription name- Returns:
- the future of the result
-
commit
Commit txn.- Parameters:
txnID
- txn id to commit.- Throws:
TransactionCoordinatorClientException
-
commitAsync
Commit txn asynchronously.- Parameters:
txnID
- txn id to commit.- Returns:
- a future represents the result of commit txn.
-
abort
Abort txn.- Parameters:
txnID
- txn id to abort.- Throws:
TransactionCoordinatorClientException
-
abortAsync
Abort txn asynchronously.- Parameters:
txnID
- txn id to abort.- Returns:
- a future represents the result of abort txn.
-
getState
TransactionCoordinatorClient.State getState()Get current state of the transaction meta store.- Returns:
- current state
TransactionCoordinatorClient.State
of the transaction meta store
-