Class CdcBuilder


  • public class CdcBuilder
    extends java.lang.Object
    • Field Detail

      • jobId

        @NotNull
        protected final java.lang.String jobId
      • partitionId

        protected final int partitionId
      • cdcOptions

        @NotNull
        protected org.apache.cassandra.cdc.api.CdcOptions cdcOptions
      • asyncExecutor

        @NotNull
        protected org.apache.cassandra.spark.utils.AsyncExecutor asyncExecutor
      • tableIdLookup

        @NotNull
        public org.apache.cassandra.cdc.api.TableIdLookup tableIdLookup
    • Constructor Detail

      • CdcBuilder

        public CdcBuilder​(@NotNull
                          java.lang.String jobId,
                          int partitionId,
                          @NotNull
                          EventConsumer eventConsumer,
                          @NotNull
                          SchemaSupplier schemaSupplier)
        Parameters:
        jobId - unique jobId to identify this CDC job. It is used the namespace the CDC state so that we can reset by changing the jobId or have multiple CDC streams running with unique jobIds.
        partitionId - partitionId is any integer value to uniquely identify this shard of CDC. This is only used for logging to assist with debugging, so each shard should have a unique partitionId.
        eventConsumer - consumer that processes the CDC updates as they are received.
        schemaSupplier - provides the schema for the CDC enabled tables.
    • Method Detail

      • withTokenRangeSupplier

        public CdcBuilder withTokenRangeSupplier​(@NotNull
                                                 TokenRangeSupplier tokenRangeSupplier)
        Returns:
        a Cassandra Token Range that this consumer should read from. This supplier is called at the start of each micro-batch to permit topology changes between micro-batches. Returning a null token range means it will attempt to read all available commit logs.
      • withCassandraSource

        public CdcBuilder withCassandraSource​(@NotNull
                                              org.apache.cassandra.cdc.api.CassandraSource cassandraSource)
      • withCdcOptions

        public CdcBuilder withCdcOptions​(@NotNull
                                         org.apache.cassandra.cdc.api.CdcOptions cdcOptions)
      • withExecutor

        public CdcBuilder withExecutor​(@NotNull
                                       java.util.concurrent.ExecutorService executor)
      • withExecutor

        public CdcBuilder withExecutor​(@NotNull
                                       org.apache.cassandra.spark.utils.AsyncExecutor asyncExecutor)
      • withTableIdLookup

        public CdcBuilder withTableIdLookup​(@NotNull
                                            org.apache.cassandra.cdc.api.TableIdLookup tableIdLookup)
      • build

        public Cdc build()