Package com.google.cloud.spanner.watcher
Interface SpannerDatabaseTailer.Builder
-
- All Known Subinterfaces:
SpannerDatabaseTailer.TableExcluder
- Enclosing class:
- SpannerDatabaseTailer
public static interface SpannerDatabaseTailer.BuilderBuilder for aSpannerDatabaseTailer.
-
-
Method Summary
-
-
-
Method Detail
-
setCommitTimestampRepository
SpannerDatabaseTailer.Builder setCommitTimestampRepository(CommitTimestampRepository repository)
Sets a specificCommitTimestampRepositoryto use for theSpannerDatabaseTailer.The default will use a
SpannerCommitTimestampRepositorywhich stores the last seen commit timestamp in a table named LAST_SEEN_COMMIT_TIMESTAMPS in the Spanner database that thisSpannerDatabaseTaileris monitoring. The table will be created if it does not already exist.
-
setShardProvider
SpannerDatabaseTailer.Builder setShardProvider(ShardProvider shardProvider)
Sets theShardProviderthat thisSpannerDatabaseTailershould use for all tables that do not have a specificShardProviderset throughsetShardProviders(Map).
-
setShardProviders
SpannerDatabaseTailer.Builder setShardProviders(Map<TableId,ShardProvider> shardProviders)
Sets theShardProviders to use for specific tables. AnyShardProviderthat is supplied through this method will override any globalShardProviderthat has been set usingsetShardProvider(ShardProvider).
-
setPollInterval
SpannerDatabaseTailer.Builder setPollInterval(org.threeten.bp.Duration interval)
Sets the poll interval to use for thisSpannerDatabaseTailer. The default is 1 second.
-
setExecutor
SpannerDatabaseTailer.Builder setExecutor(ScheduledExecutorService executor)
Sets a specificScheduledExecutorServiceto use for thisSpannerDatabaseTailer. This executor will be used to execute the poll queries on the tables and to call theSpannerTableChangeWatcher.RowChangeCallbacks. The default will use aScheduledThreadPoolExecutorwith a core size equal to the number of tables that is being monitored.
-
setCommitTimestampColumnFunction
SpannerDatabaseTailer.Builder setCommitTimestampColumnFunction(Function<TableId,String> commitTimestampFunction)
This should only be set if your tables contain more than one commit timestamp column.Sets a function that returns the commit timestamp column to use for a specific table. This is only needed in case your tables contain more than one commit timestamp column.
SpannerDatabaseTailercan automatically find the commit timestamp column for tables that only contain one column with allow_commit_timestamp=true.- Parameters:
commitTimestampFunction- The function to use to determine which commit timestamp column should be used for a specific table. If no function has been specified, or if the function returnsnullfor a givenTableId, theSpannerDatabaseTailerwill automatically use the first column of the table that has the option allow_commit_timestamp=true.- Returns:
- The Builder.
-
build
SpannerDatabaseTailer build()
Creates aSpannerDatabaseTailerfrom this builder.
-
-