Class CassandraRowWriteAheadSink

  • All Implemented Interfaces:
    Serializable, org.apache.flink.api.common.state.CheckpointListener, org.apache.flink.streaming.api.operators.Input<org.apache.flink.types.Row>, org.apache.flink.streaming.api.operators.KeyContext, org.apache.flink.streaming.api.operators.OneInputStreamOperator<org.apache.flink.types.Row,​org.apache.flink.types.Row>, org.apache.flink.streaming.api.operators.SetupableStreamOperator<org.apache.flink.types.Row>, org.apache.flink.streaming.api.operators.StreamOperator<org.apache.flink.types.Row>, org.apache.flink.streaming.api.operators.StreamOperatorStateHandler.CheckpointedStreamOperator

    public class CassandraRowWriteAheadSink
    extends org.apache.flink.streaming.runtime.operators.GenericWriteAheadSink<org.apache.flink.types.Row>
    Sink that emits its input elements into a Cassandra table. This sink stores incoming records within a AbstractStateBackend, and only commits them to Cassandra if a checkpoint is completed.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected com.datastax.driver.core.Cluster cluster  
      protected com.datastax.driver.core.Session session  
      • Fields inherited from class org.apache.flink.streaming.runtime.operators.GenericWriteAheadSink

        LOG, serializer
      • Fields inherited from class org.apache.flink.streaming.api.operators.AbstractStreamOperator

        chainingStrategy, config, latencyStats, metrics, output, processingTimeService
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected CassandraRowWriteAheadSink​(String insertQuery, org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.types.Row> serializer, ClusterBuilder builder, org.apache.flink.streaming.runtime.operators.CheckpointCommitter committer)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void open()  
      protected boolean sendValues​(Iterable<org.apache.flink.types.Row> values, long checkpointId, long timestamp)  
      • Methods inherited from class org.apache.flink.streaming.runtime.operators.GenericWriteAheadSink

        initializeState, notifyCheckpointComplete, processElement, snapshotState
      • Methods inherited from class org.apache.flink.streaming.api.operators.AbstractStreamOperator

        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
      • Methods inherited from interface org.apache.flink.api.common.state.CheckpointListener

        notifyCheckpointAborted
      • Methods inherited from interface org.apache.flink.streaming.api.operators.Input

        processLatencyMarker, processWatermark, processWatermarkStatus
      • Methods inherited from interface org.apache.flink.streaming.api.operators.KeyContext

        getCurrentKey, setCurrentKey
      • Methods inherited from interface org.apache.flink.streaming.api.operators.OneInputStreamOperator

        setKeyContextElement
      • Methods inherited from interface org.apache.flink.streaming.api.operators.StreamOperator

        finish, getMetricGroup, getOperatorID, initializeState, prepareSnapshotPreBarrier, setKeyContextElement1, setKeyContextElement2, snapshotState
    • Field Detail

      • cluster

        protected transient com.datastax.driver.core.Cluster cluster
      • session

        protected transient com.datastax.driver.core.Session session
    • Constructor Detail

      • CassandraRowWriteAheadSink

        protected CassandraRowWriteAheadSink​(String insertQuery,
                                             org.apache.flink.api.common.typeutils.TypeSerializer<org.apache.flink.types.Row> serializer,
                                             ClusterBuilder builder,
                                             org.apache.flink.streaming.runtime.operators.CheckpointCommitter committer)
                                      throws Exception
        Throws:
        Exception
    • Method Detail

      • open

        public void open()
                  throws Exception
        Specified by:
        open in interface org.apache.flink.streaming.api.operators.StreamOperator<org.apache.flink.types.Row>
        Overrides:
        open in class org.apache.flink.streaming.runtime.operators.GenericWriteAheadSink<org.apache.flink.types.Row>
        Throws:
        Exception
      • close

        public void close()
                   throws Exception
        Specified by:
        close in interface org.apache.flink.streaming.api.operators.StreamOperator<org.apache.flink.types.Row>
        Overrides:
        close in class org.apache.flink.streaming.runtime.operators.GenericWriteAheadSink<org.apache.flink.types.Row>
        Throws:
        Exception
      • sendValues

        protected boolean sendValues​(Iterable<org.apache.flink.types.Row> values,
                                     long checkpointId,
                                     long timestamp)
                              throws Exception
        Specified by:
        sendValues in class org.apache.flink.streaming.runtime.operators.GenericWriteAheadSink<org.apache.flink.types.Row>
        Throws:
        Exception