Interface TransactionCoordinatorClient

  • All Superinterfaces:
    java.lang.AutoCloseable, java.io.Closeable

    @Private
    @Evolving
    public interface TransactionCoordinatorClient
    extends java.io.Closeable
    Transaction coordinator client.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static long DEFAULT_TXN_TTL_MS
      Default transaction ttl in mills.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void abort​(TxnID txnID)
      Abort txn.
      java.util.concurrent.CompletableFuture<java.lang.Void> abortAsync​(TxnID txnID)
      Abort txn asynchronously.
      void addPublishPartitionToTxn​(TxnID txnID, java.util.List<java.lang.String> partitions)
      Add publish partition to txn.
      java.util.concurrent.CompletableFuture<java.lang.Void> addPublishPartitionToTxnAsync​(TxnID txnID, java.util.List<java.lang.String> partitions)
      Add publish partition to txn asynchronously.
      void addSubscriptionToTxn​(TxnID txnID, java.lang.String topic, java.lang.String subscription)
      Add ack subscription to txn.
      java.util.concurrent.CompletableFuture<java.lang.Void> addSubscriptionToTxnAsync​(TxnID txnID, java.lang.String topic, java.lang.String subscription)
      Add ack subscription to txn asynchronously.
      java.util.concurrent.CompletableFuture<java.lang.Void> closeAsync()
      Close the transaction meta store client asynchronous.
      void commit​(TxnID txnID)
      Commit txn.
      java.util.concurrent.CompletableFuture<java.lang.Void> commitAsync​(TxnID txnID)
      Commit txn asynchronously.
      TransactionCoordinatorClient.State getState()
      Get current state of the transaction meta store.
      TxnID newTransaction()
      Create a new transaction.
      TxnID newTransaction​(long timeout, java.util.concurrent.TimeUnit unit)
      Create a new transaction.
      java.util.concurrent.CompletableFuture<TxnID> newTransactionAsync()
      Create a new transaction asynchronously.
      java.util.concurrent.CompletableFuture<TxnID> newTransactionAsync​(long timeout, java.util.concurrent.TimeUnit unit)
      Create a new transaction asynchronously.
      void start()
      Start transaction meta store client.
      java.util.concurrent.CompletableFuture<java.lang.Void> startAsync()
      Start transaction meta store client asynchronous.
      • Methods inherited from interface java.io.Closeable

        close
    • Field Detail

      • DEFAULT_TXN_TTL_MS

        static final long DEFAULT_TXN_TTL_MS
        Default transaction ttl in mills.
        See Also:
        Constant Field Values
    • Method Detail

      • startAsync

        java.util.concurrent.CompletableFuture<java.lang.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

        java.util.concurrent.CompletableFuture<java.lang.Void> closeAsync()
        Close the transaction meta store client asynchronous.
        Returns:
        a future represents the result of close transaction meta store
      • newTransactionAsync

        java.util.concurrent.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.
      • newTransactionAsync

        java.util.concurrent.CompletableFuture<TxnID> newTransactionAsync​(long timeout,
                                                                          java.util.concurrent.TimeUnit unit)
        Create a new transaction asynchronously.
        Parameters:
        timeout - timeout for new transaction
        unit - 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.
      • addPublishPartitionToTxnAsync

        java.util.concurrent.CompletableFuture<java.lang.Void> addPublishPartitionToTxnAsync​(TxnID txnID,
                                                                                             java.util.List<java.lang.String> partitions)
        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.
      • addSubscriptionToTxnAsync

        java.util.concurrent.CompletableFuture<java.lang.Void> addSubscriptionToTxnAsync​(TxnID txnID,
                                                                                         java.lang.String topic,
                                                                                         java.lang.String subscription)
        Add ack subscription to txn asynchronously.
        Parameters:
        txnID - transaction id
        topic - topic name
        subscription - subscription name
        Returns:
        the future of the result
      • commitAsync

        java.util.concurrent.CompletableFuture<java.lang.Void> commitAsync​(TxnID txnID)
        Commit txn asynchronously.
        Parameters:
        txnID - txn id to commit.
        Returns:
        a future represents the result of commit txn.
      • abortAsync

        java.util.concurrent.CompletableFuture<java.lang.Void> abortAsync​(TxnID txnID)
        Abort txn asynchronously.
        Parameters:
        txnID - txn id to abort.
        Returns:
        a future represents the result of abort txn.