Class LtdbKafkaTask

java.lang.Object
org.apache.kafka.connect.sink.SinkTask
org.eso.ias.sink.ltdb.LtdbKafkaTask
All Implemented Interfaces:
Runnable, org.apache.kafka.connect.connector.Task

public class LtdbKafkaTask extends org.apache.kafka.connect.sink.SinkTask implements Runnable
The task run by the kafka connector for the LTDB. It saves IASIOs in the Cassandra database. No need to synchronize because Kafka connectors run on a single thread. Received IASIOs are saved in the buffer to quickly return from the put method. Asynchronously the thread stores IASIOs in the LTDB. When the flush is executed all the remainings IASIOs in the buffer are saved in the LTDB.
Author:
acaproni
  • Field Summary

    Fields inherited from class org.apache.kafka.connect.sink.SinkTask

    context, TOPICS_CONFIG, TOPICS_REGEX_CONFIG
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    flush(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> currentOffsets)
     
    void
    put(Collection<org.apache.kafka.connect.sink.SinkRecord> records)
     
    void
    run()
    The thread that store elements in the LTDB before the flush is called.
    void
     
    void
     
     

    Methods inherited from class org.apache.kafka.connect.sink.SinkTask

    close, initialize, onPartitionsAssigned, onPartitionsRevoked, open, preCommit

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LtdbKafkaTask

      public LtdbKafkaTask()
  • Method Details

    • version

      public String version()
      Specified by:
      version in interface org.apache.kafka.connect.connector.Task
    • start

      public void start(Map<String,String> map)
      Specified by:
      start in interface org.apache.kafka.connect.connector.Task
      Specified by:
      start in class org.apache.kafka.connect.sink.SinkTask
    • put

      public void put(Collection<org.apache.kafka.connect.sink.SinkRecord> records)
      Specified by:
      put in class org.apache.kafka.connect.sink.SinkTask
    • stop

      public void stop()
      Specified by:
      stop in interface org.apache.kafka.connect.connector.Task
      Specified by:
      stop in class org.apache.kafka.connect.sink.SinkTask
    • flush

      public void flush(Map<org.apache.kafka.common.TopicPartition,org.apache.kafka.clients.consumer.OffsetAndMetadata> currentOffsets)
      Overrides:
      flush in class org.apache.kafka.connect.sink.SinkTask
    • run

      public void run()
      The thread that store elements in the LTDB before the flush is called. The thread logs statistics if the time interval elapsed.
      Specified by:
      run in interface Runnable