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 at the very end of the operator's life, both in the case of a
successful completion of the operation, and in the case of a failure and canceling.
|
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
finish, 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, processWatermarkStatus, processWatermarkStatus1, processWatermarkStatus2, registerCounterOnOutput, reportOrForwardLatencyMarker, setChainingStrategy, setCurrentKey, setKeyContextElement1, setKeyContextElement2, setProcessingTimeService, setup, snapshotState
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setKeyContextElement
finish, getMetricGroup, getOperatorID, initializeState, prepareSnapshotPreBarrier, setKeyContextElement1, setKeyContextElement2, snapshotState
notifyCheckpointAborted
getCurrentKey, setCurrentKey
processLatencyMarker, processWatermark, processWatermarkStatus
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
StreamOperator
This method is expected to make a thorough effort to release all resources that the operator has acquired.
NOTE:It can not emit any records! If you need to emit records at the end of
processing, do so in the StreamOperator.finish()
method.
close
in interface StreamOperator<Row>
close
in class GenericWriteAheadSink<Row>
Exception
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.