Class KafkaPushSource<T>

java.lang.Object
org.apache.pulsar.io.kafka.KafkaPushSource<T>
All Implemented Interfaces:
AutoCloseable, org.apache.pulsar.io.core.Source<T>
Direct Known Subclasses:
KafkaAbstractSource

public abstract class KafkaPushSource<T> extends Object implements org.apache.pulsar.io.core.Source<T>
Kafka Push Source. To maintain compatibility, we can't pick the PIP-281: https://github.com/apache/pulsar/pull/20807 cherry-pick to the historical version, so the class is implemented in the kafka connector.
  • Constructor Details

    • KafkaPushSource

      public KafkaPushSource()
  • Method Details

    • read

      public org.apache.pulsar.functions.api.Record<T> read() throws Exception
      Specified by:
      read in interface org.apache.pulsar.io.core.Source<T>
      Throws:
      Exception
    • consume

      public void consume(org.apache.pulsar.functions.api.Record<T> record)
      Send this message to be written to Pulsar. Pass null if you you are done with this task
      Parameters:
      record - next message from source which should be sent to a Pulsar topic
    • getQueueLength

      public int getQueueLength()
      Get length of the queue that records are push onto. Users can override this method to customize the queue length
      Returns:
      queue length
    • notifyError

      public void notifyError(Exception ex)
      Allows the source to notify errors asynchronously.
      Parameters:
      ex -