@Internal public class BigtableChangeStreamAccessor extends java.lang.Object implements java.lang.AutoCloseable
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.
Modifier and Type | Method and Description |
---|---|
void |
close() |
com.google.cloud.bigtable.data.v2.BigtableDataClient |
getDataClient() |
com.google.cloud.bigtable.admin.v2.BigtableInstanceAdminClient |
getInstanceAdminClient() |
static BigtableChangeStreamAccessor |
getOrCreate(@NonNull BigtableConfig bigtableConfig)
Create a BigtableAccess if it doesn't exist and store it in the cache for faster access.
|
com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient |
getTableAdminClient() |
public void close()
close
in interface java.lang.AutoCloseable
public static BigtableChangeStreamAccessor getOrCreate(@NonNull BigtableConfig bigtableConfig) throws java.io.IOException
bigtableConfig
- config that contains all the parameters to connect to a Cloud Bigtable
instancejava.io.IOException
- if the connection failspublic com.google.cloud.bigtable.data.v2.BigtableDataClient getDataClient()
public com.google.cloud.bigtable.admin.v2.BigtableTableAdminClient getTableAdminClient()
public com.google.cloud.bigtable.admin.v2.BigtableInstanceAdminClient getInstanceAdminClient()