Class BatchPushSource<T>

java.lang.Object
org.apache.pulsar.io.core.BatchPushSource<T>
All Implemented Interfaces:
AutoCloseable, BatchSource<T>

@Public @Evolving public abstract class BatchPushSource<T> extends Object implements BatchSource<T>
Pulsar's Batch Push Source interface. Batch Push Sources have the same lifecycle as the regular BatchSource, aka discover, prepare. The reason its called Push is because BatchPushSource can emit a record using the consume method that they invoke whenever they have data to be published to Pulsar.
  • Constructor Details

    • BatchPushSource

      public BatchPushSource()
  • Method Details

    • readNext

      public Record<T> readNext() throws Exception
      Description copied from interface: BatchSource
      Read data and return a record. Return null if no more records are present for this task
      Specified by:
      readNext in interface BatchSource<T>
      Returns:
      a record
      Throws:
      Exception
    • consume

      public void consume(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 -