IN
- public abstract static class CassandraSink.CassandraSinkBuilder<IN> extends Object
CassandraSink
.Modifier and Type | Field and Description |
---|---|
protected ClusterBuilder |
builder |
protected CheckpointCommitter |
committer |
protected CassandraSinkBaseConfig.Builder |
configBuilder |
protected CassandraFailureHandler |
failureHandler |
protected DataStream<IN> |
input |
protected boolean |
isWriteAheadLogEnabled |
protected String |
keyspace |
protected MapperOptions |
mapperOptions |
protected String |
query |
protected TypeSerializer<IN> |
serializer |
protected TypeInformation<IN> |
typeInfo |
Constructor and Description |
---|
CassandraSinkBuilder(DataStream<IN> input,
TypeInformation<IN> typeInfo,
TypeSerializer<IN> serializer) |
Modifier and Type | Method and Description |
---|---|
CassandraSink<IN> |
build()
Finalizes the configuration of this sink.
|
protected abstract CassandraSink<IN> |
createSink() |
protected abstract CassandraSink<IN> |
createWriteAheadSink() |
CassandraSink.CassandraSinkBuilder<IN> |
enableIgnoreNullFields()
Enables ignoring null values, treats null values as unset and avoids writing null fields
and creating tombstones.
|
CassandraSink.CassandraSinkBuilder<IN> |
enableWriteAheadLog()
Enables the write-ahead log, which allows exactly-once processing for non-deterministic
algorithms that use idempotent updates.
|
CassandraSink.CassandraSinkBuilder<IN> |
enableWriteAheadLog(CheckpointCommitter committer)
Enables the write-ahead log, which allows exactly-once processing for non-deterministic
algorithms that use idempotent updates.
|
protected void |
sanityCheck() |
CassandraSink.CassandraSinkBuilder<IN> |
setClusterBuilder(ClusterBuilder builder)
Sets the ClusterBuilder for this sink.
|
CassandraSink.CassandraSinkBuilder<IN> |
setDefaultKeyspace(String keyspace)
Sets the keyspace to be used.
|
CassandraSink.CassandraSinkBuilder<IN> |
setFailureHandler(CassandraFailureHandler failureHandler)
Sets the failure handler for this sink.
|
CassandraSink.CassandraSinkBuilder<IN> |
setHost(String host)
Sets the cassandra host to connect to.
|
CassandraSink.CassandraSinkBuilder<IN> |
setHost(String host,
int port)
Sets the cassandra host/port to connect to.
|
CassandraSink.CassandraSinkBuilder<IN> |
setMapperOptions(MapperOptions options)
Sets the mapper options for this sink.
|
CassandraSink.CassandraSinkBuilder<IN> |
setMaxConcurrentRequests(int maxConcurrentRequests)
Sets the maximum allowed number of concurrent requests for this sink.
|
CassandraSink.CassandraSinkBuilder<IN> |
setMaxConcurrentRequests(int maxConcurrentRequests,
java.time.Duration timeout)
Sets the maximum allowed number of concurrent requests for this sink.
|
CassandraSink.CassandraSinkBuilder<IN> |
setQuery(String query)
Sets the query that is to be executed for every record.
|
protected final DataStream<IN> input
protected final TypeSerializer<IN> serializer
protected final TypeInformation<IN> typeInfo
protected final CassandraSinkBaseConfig.Builder configBuilder
protected ClusterBuilder builder
protected String keyspace
protected MapperOptions mapperOptions
protected String query
protected CheckpointCommitter committer
protected boolean isWriteAheadLogEnabled
protected CassandraFailureHandler failureHandler
public CassandraSinkBuilder(DataStream<IN> input, TypeInformation<IN> typeInfo, TypeSerializer<IN> serializer)
public CassandraSink.CassandraSinkBuilder<IN> setQuery(String query)
query
- query to usepublic CassandraSink.CassandraSinkBuilder<IN> setDefaultKeyspace(String keyspace)
keyspace
- keyspace to usepublic CassandraSink.CassandraSinkBuilder<IN> setHost(String host)
host
- host to connect topublic CassandraSink.CassandraSinkBuilder<IN> setHost(String host, int port)
host
- host to connect toport
- port to connect topublic CassandraSink.CassandraSinkBuilder<IN> setClusterBuilder(ClusterBuilder builder)
builder
- ClusterBuilder to configure the connection to cassandrapublic CassandraSink.CassandraSinkBuilder<IN> enableWriteAheadLog()
public CassandraSink.CassandraSinkBuilder<IN> enableWriteAheadLog(CheckpointCommitter committer)
committer
- CheckpointCommitter, that stores information about completed checkpoints
in an external resource. By default this information is stored within a separate
table within Cassandra.public CassandraSink.CassandraSinkBuilder<IN> setMapperOptions(MapperOptions options)
Mapper
when writing POJOs.
This call has no effect if the input DataStream
for this sink does not contain
POJOs.
options
- MapperOptions, that return an array of options that are used to configure
the DataStax mapper.public CassandraSink.CassandraSinkBuilder<IN> setFailureHandler(CassandraFailureHandler failureHandler)
failureHandler
- CassandraFailureHandler, that handles any Throwable error.public CassandraSink.CassandraSinkBuilder<IN> setMaxConcurrentRequests(int maxConcurrentRequests, java.time.Duration timeout)
This call has no effect if enableWriteAheadLog()
is
called.
maxConcurrentRequests
- maximum number of concurrent requests allowedtimeout
- timeout duration when acquiring a permit to executepublic CassandraSink.CassandraSinkBuilder<IN> setMaxConcurrentRequests(int maxConcurrentRequests)
This call has no effect if enableWriteAheadLog()
is
called.
maxConcurrentRequests
- maximum number of concurrent requests allowedpublic CassandraSink.CassandraSinkBuilder<IN> enableIgnoreNullFields()
This call has no effect if enableWriteAheadLog()
is
called.
public CassandraSink<IN> build() throws Exception
Exception
protected abstract CassandraSink<IN> createSink() throws Exception
Exception
protected abstract CassandraSink<IN> createWriteAheadSink() throws Exception
Exception
protected void sanityCheck()
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.