Interface CdcSource

All Superinterfaces:
AutoCloseable

public interface CdcSource extends AutoCloseable
Reads change events from a single CDC source (e.g. local GridGain tables or an external database) and pushes them to a subscriber as WatermarkedBatches.

A source instance is created per replication via a source factory keyed on SourceType, and start(org.gridgain.internal.cdc.api.source.SourceTableDefinition, byte[], org.gridgain.internal.cdc.api.replication.CdcReplicationMode, java.util.concurrent.Flow.Subscriber<org.gridgain.internal.cdc.api.source.WatermarkedBatch>) is invoked once per replicated table. Implementations own all source-side resources (connections, continuous-query views, poller threads) and release them in AutoCloseable.close().

  • Method Details

    • start

      void start(SourceTableDefinition table, byte @Nullable [] lastWatermark, CdcReplicationMode mode, Flow.Subscriber<WatermarkedBatch> subscriber)
      Begins streaming change events for a single table to subscriber.

      The implementation calls Flow.Subscriber.onSubscribe(java.util.concurrent.Flow.Subscription) with a subscription whose cancel() stops the stream, then pushes WatermarkedBatches via Flow.Subscriber.onNext(T). Each batch carries the watermark the source assigns to it.

      Each event's (key, value) tuple pair must be split by the source table's primary key: the key tuple holds exactly the key columns and the value tuple only the remaining columns. Sinks write the pair through key-value views, which reject value tuples that repeat key columns.

      Parameters:
      table - The table to read changes from.
      lastWatermark - The watermark to resume after, or null to start according to mode.
      mode - The replication mode (e.g. only new data, or all existing data first).
      subscriber - The subscriber that consumes the produced batches.