public class CassandraRowWriteAheadSink extends GenericWriteAheadSink<Row>
AbstractStateBackend
, and only commits them to
Cassandra if a checkpoint is completed.Modifier and Type | Field and Description |
---|---|
protected com.datastax.driver.core.Cluster |
cluster |
protected com.datastax.driver.core.Session |
session |
LOG, serializer
chainingStrategy, config, latencyStats, metrics, output, processingTimeService
Modifier | Constructor and Description |
---|---|
protected |
CassandraRowWriteAheadSink(String insertQuery,
TypeSerializer<Row> serializer,
ClusterBuilder builder,
CheckpointCommitter committer) |
Modifier and Type | Method and Description |
---|---|
void |
close()
This method is called after all records have been added to the operators via the methods
Input.processElement(StreamRecord) , or TwoInputStreamOperator.processElement1(StreamRecord) and TwoInputStreamOperator.processElement2(StreamRecord) . |
void |
open()
This method is called immediately before any elements are processed, it should contain the
operator's initialization logic, e.g.
|
protected boolean |
sendValues(Iterable<Row> values,
long checkpointId,
long timestamp)
Write the given element into the backend.
|
initializeState, notifyCheckpointComplete, processElement, snapshotState
dispose, getChainingStrategy, getContainingTask, getCurrentKey, getExecutionConfig, getInternalTimerService, getKeyedStateBackend, getKeyedStateStore, getMetricGroup, getOperatorConfig, getOperatorID, getOperatorName, getOperatorStateBackend, getOrCreateKeyedState, getPartitionedState, getPartitionedState, getProcessingTimeService, getRuntimeContext, getTimeServiceManager, getUserCodeClassloader, initializeState, isUsingCustomRawKeyedState, notifyCheckpointAborted, prepareSnapshotPreBarrier, processLatencyMarker, processLatencyMarker1, processLatencyMarker2, processWatermark, processWatermark1, processWatermark2, reportOrForwardLatencyMarker, setChainingStrategy, setCurrentKey, setKeyContextElement1, setKeyContextElement2, setProcessingTimeService, setup, snapshotState
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setKeyContextElement
dispose, getMetricGroup, getOperatorID, initializeState, prepareSnapshotPreBarrier, setKeyContextElement1, setKeyContextElement2, snapshotState
notifyCheckpointAborted
getCurrentKey, setCurrentKey
processLatencyMarker, processWatermark
protected transient com.datastax.driver.core.Cluster cluster
protected transient com.datastax.driver.core.Session session
protected CassandraRowWriteAheadSink(String insertQuery, TypeSerializer<Row> serializer, ClusterBuilder builder, CheckpointCommitter committer) throws Exception
Exception
public void open() throws Exception
AbstractStreamOperator
The default implementation does nothing.
open
in interface StreamOperator<Row>
open
in class GenericWriteAheadSink<Row>
Exception
- An exception in this method causes the operator to fail.public void close() throws Exception
AbstractStreamOperator
Input.processElement(StreamRecord)
, or TwoInputStreamOperator.processElement1(StreamRecord)
and TwoInputStreamOperator.processElement2(StreamRecord)
.
The method is expected to flush all remaining buffered data. Exceptions during this flushing of buffered should be propagated, in order to cause the operation to be recognized asa failed, because the last data items are not processed properly.
close
in interface StreamOperator<Row>
close
in class GenericWriteAheadSink<Row>
Exception
- An exception in this method causes the operator to fail.protected boolean sendValues(Iterable<Row> values, long checkpointId, long timestamp) throws Exception
GenericWriteAheadSink
sendValues
in class GenericWriteAheadSink<Row>
values
- The values to be writtencheckpointId
- The checkpoint ID of the checkpoint to be writtentimestamp
- The wall-clock timestamp of the checkpointException
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.