Package org.apache.cassandra.cdc
Class CdcBuilder
- java.lang.Object
-
- org.apache.cassandra.cdc.CdcBuilder
-
public class CdcBuilder extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected org.apache.cassandra.spark.utils.AsyncExecutorasyncExecutorprotected org.apache.cassandra.cdc.api.CdcOptionscdcOptionsprotected CommitLogProvidercommitLogProviderprotected EventConsumereventConsumerprotected java.lang.StringjobIdprotected intpartitionIdprotected SchemaSupplierschemaSupplierorg.apache.cassandra.cdc.api.TableIdLookuptableIdLookup
-
Constructor Summary
Constructors Constructor Description CdcBuilder(java.lang.String jobId, int partitionId, EventConsumer eventConsumer, SchemaSupplier schemaSupplier)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Cdcbuild()CdcBuilderwithCassandraSource(org.apache.cassandra.cdc.api.CassandraSource cassandraSource)CdcBuilderwithCdcOptions(org.apache.cassandra.cdc.api.CdcOptions cdcOptions)CdcBuilderwithCommitLogProvider(CommitLogProvider commitLogProvider)CdcBuilderwithEventConsumer(EventConsumer eventConsumer)CdcBuilderwithExecutor(java.util.concurrent.ExecutorService executor)CdcBuilderwithExecutor(org.apache.cassandra.spark.utils.AsyncExecutor asyncExecutor)CdcBuilderwithSchemaSupplier(SchemaSupplier schemaSupplier)CdcBuilderwithStatePersister(StatePersister statePersister)CdcBuilderwithStats(CdcStats stats)CdcBuilderwithTableIdLookup(org.apache.cassandra.cdc.api.TableIdLookup tableIdLookup)CdcBuilderwithTokenRangeSupplier(TokenRangeSupplier tokenRangeSupplier)
-
-
-
Field Detail
-
jobId
@NotNull protected final java.lang.String jobId
-
partitionId
protected final int partitionId
-
schemaSupplier
@NotNull protected SchemaSupplier schemaSupplier
-
cdcOptions
@NotNull protected org.apache.cassandra.cdc.api.CdcOptions cdcOptions
-
asyncExecutor
@NotNull protected org.apache.cassandra.spark.utils.AsyncExecutor asyncExecutor
-
commitLogProvider
@Nullable protected CommitLogProvider commitLogProvider
-
eventConsumer
@NotNull protected EventConsumer eventConsumer
-
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)
-
withStatePersister
public CdcBuilder withStatePersister(@NotNull StatePersister statePersister)
-
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)
-
withCommitLogProvider
public CdcBuilder withCommitLogProvider(@NotNull CommitLogProvider commitLogProvider)
-
withStats
public CdcBuilder withStats(@NotNull CdcStats stats)
-
withEventConsumer
public CdcBuilder withEventConsumer(@NotNull EventConsumer eventConsumer)
-
withTableIdLookup
public CdcBuilder withTableIdLookup(@NotNull org.apache.cassandra.cdc.api.TableIdLookup tableIdLookup)
-
withSchemaSupplier
public CdcBuilder withSchemaSupplier(@NotNull SchemaSupplier schemaSupplier)
-
build
public Cdc build()
-
-