Class BigtableChangeStreamAccessor

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    @Internal
    public class BigtableChangeStreamAccessor
    extends java.lang.Object
    implements java.lang.AutoCloseable
    This is probably a temporary solution to what is a bigger migration from cloud-bigtable-client-core to java-bigtable.

    This class creates and maintains the lifecycle java-bigtable clients to interact with Cloud Bigtable. This class creates singletons of data and admin clients for each project/instance/table/app profile. Per workers, there should only be 1 instance of the client for each table/app profile. This ensures we're not creating many/excessive connections with the backend and the jobs on the same machine shares the same sets of connections.

    • Method Detail

      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
      • setReadChangeStreamTimeout

        public static void setReadChangeStreamTimeout​(org.threeten.bp.Duration timeout)
      • getOrCreate

        public static BigtableChangeStreamAccessor getOrCreate​(@NonNull BigtableConfig bigtableConfig)
                                                        throws java.io.IOException
        Create a BigtableAccess if it doesn't exist and store it in the cache for faster access. If it does exist, just return it.
        Parameters:
        bigtableConfig - config that contains all the parameters to connect to a Cloud Bigtable instance
        Returns:
        data and admin clients connected to the Cloud Bigtable instance
        Throws:
        java.io.IOException - if the connection fails
      • getDataClient

        public com.google.cloud.bigtable.data.v2.BigtableDataClient getDataClient()
      • getTableAdminClient

        public com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient getTableAdminClient()
      • getInstanceAdminClient

        public com.google.cloud.bigtable.admin.v2.BigtableInstanceAdminClient getInstanceAdminClient()