Class VerifiableSourceTask

java.lang.Object
org.apache.kafka.connect.source.SourceTask
org.apache.kafka.connect.tools.VerifiableSourceTask
All Implemented Interfaces:
org.apache.kafka.connect.connector.Task

public class VerifiableSourceTask extends org.apache.kafka.connect.source.SourceTask
A connector primarily intended for system tests. The connector simply generates as many tasks as requested. The tasks print metadata in the form of JSON to stdout for each message generated, making externally visible which messages have been sent. Each message is also assigned a unique, increasing seqno that is passed to Kafka Connect; when tasks are started on new nodes, this seqno is used to resume where the task previously left off, allowing for testing of distributed Kafka Connect.

If logging is left enabled, log output on stdout can be easily ignored by checking whether a given line is valid JSON.

  • Field Details

  • Constructor Details

    • VerifiableSourceTask

      public VerifiableSourceTask()
  • Method Details

    • version

      public String version()
    • start

      public void start(Map<String,String> props)
      Specified by:
      start in interface org.apache.kafka.connect.connector.Task
      Specified by:
      start in class org.apache.kafka.connect.source.SourceTask
    • poll

      public List<org.apache.kafka.connect.source.SourceRecord> poll()
      Specified by:
      poll in class org.apache.kafka.connect.source.SourceTask
    • commitRecord

      public void commitRecord(org.apache.kafka.connect.source.SourceRecord record, org.apache.kafka.clients.producer.RecordMetadata metadata)
      Overrides:
      commitRecord in class org.apache.kafka.connect.source.SourceTask
    • stop

      public void stop()
      Specified by:
      stop in interface org.apache.kafka.connect.connector.Task
      Specified by:
      stop in class org.apache.kafka.connect.source.SourceTask