IN
- Type of the elements emitted by this sinkpublic class CassandraTupleWriteAheadSink<IN extends Tuple> extends GenericWriteAheadSink<IN>
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 |
CassandraTupleWriteAheadSink(String insertQuery,
TypeSerializer<IN> 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
OneInputStreamOperator.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<IN> 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, numEventTimeTimers, numProcessingTimeTimers, 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
processLatencyMarker, processWatermark
dispose, getMetricGroup, getOperatorID, initializeState, prepareSnapshotPreBarrier, setKeyContextElement1, setKeyContextElement2, snapshotState
notifyCheckpointAborted
getCurrentKey, setCurrentKey
protected transient com.datastax.driver.core.Cluster cluster
protected transient com.datastax.driver.core.Session session
protected CassandraTupleWriteAheadSink(String insertQuery, TypeSerializer<IN> serializer, ClusterBuilder builder, CheckpointCommitter committer) throws Exception
Exception
public void open() throws Exception
AbstractStreamOperator
The default implementation does nothing.
open
in interface StreamOperator<IN extends Tuple>
open
in class GenericWriteAheadSink<IN extends Tuple>
Exception
- An exception in this method causes the operator to fail.public void close() throws Exception
AbstractStreamOperator
OneInputStreamOperator.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<IN extends Tuple>
close
in class GenericWriteAheadSink<IN extends Tuple>
Exception
- An exception in this method causes the operator to fail.protected boolean sendValues(Iterable<IN> values, long checkpointId, long timestamp) throws Exception
GenericWriteAheadSink
sendValues
in class GenericWriteAheadSink<IN extends Tuple>
values
- The values to be writtencheckpointId
- The checkpoint ID of the checkpoint to be writtentimestamp
- The wall-clock timestamp of the checkpointException
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.