Package org.apache.pulsar.io.core
Class BatchPushSource<T>
java.lang.Object
org.apache.pulsar.io.core.BatchPushSource<T>
- All Implemented Interfaces:
AutoCloseable,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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSend this message to be written to Pulsar.intGet length of the queue that records are push onto.voidnotifyError(Exception ex) Allows the source to notify errors asynchronously.org.apache.pulsar.functions.api.Record<T>readNext()Read data and return a record.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.AutoCloseable
closeMethods inherited from interface org.apache.pulsar.io.core.BatchSource
discover, open, prepare
-
Constructor Details
-
BatchPushSource
public BatchPushSource()
-
-
Method Details
-
readNext
Description copied from interface:BatchSourceRead data and return a record. Return null if no more records are present for this task- Specified by:
readNextin interfaceBatchSource<T>- Returns:
- a record
- Throws:
Exception
-
consume
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
Allows the source to notify errors asynchronously.- Parameters:
ex-
-