Package org.eso.ias.sink.ltdb
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
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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
stop()
version()
Methods inherited from class org.apache.kafka.connect.sink.SinkTask
close, initialize, onPartitionsAssigned, onPartitionsRevoked, open, preCommit
-
Constructor Details
-
LtdbKafkaTask
public LtdbKafkaTask()
-
-
Method Details
-
version
- Specified by:
version
in interfaceorg.apache.kafka.connect.connector.Task
-
start
- Specified by:
start
in interfaceorg.apache.kafka.connect.connector.Task
- Specified by:
start
in classorg.apache.kafka.connect.sink.SinkTask
-
put
- Specified by:
put
in classorg.apache.kafka.connect.sink.SinkTask
-
stop
public void stop()- Specified by:
stop
in interfaceorg.apache.kafka.connect.connector.Task
- Specified by:
stop
in classorg.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 classorg.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.
-