Class SpannerTableTailer

  • All Implemented Interfaces:
    com.google.api.core.ApiService, SpannerTableChangeWatcher

    public class SpannerTableTailer
    extends com.google.api.core.AbstractApiService
    implements SpannerTableChangeWatcher
    Implementation of the SpannerTableChangeWatcher interface that continuously polls a table for changes based on a commit timestamp column in the table.

    Usage:

    {@code
     String instance = "my-instance";
     String database = "my-database";
     String table = "MY_TABLE";
    
     Spanner spanner = SpannerOptions.getDefaultInstance().getService();
     TableId tableId =
         TableId.of(DatabaseId.of(SpannerOptions.getDefaultProjectId(), instance, database), table);
     SpannerTableChangeWatcher watcher = SpannerTableTailer.newBuilder(spanner, tableId).build();
     watcher.addCallback(
         new RowChangeCallback() {