Class ExampleSourceTask
java.lang.Object
org.apache.kafka.connect.source.SourceTask
io.aiven.commons.kafka.connector.source.AbstractSourceTask
io.aiven.commons.kafka.connector.source.impl.ExampleSourceTask
- All Implemented Interfaces:
org.apache.kafka.connect.connector.Task
An example implementation of the Source task.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.kafka.connect.source.SourceTask
org.apache.kafka.connect.source.SourceTask.TransactionBoundary -
Field Summary
Fields inherited from class io.aiven.commons.kafka.connector.source.AbstractSourceTask
MAX_POLL_TIME, NULL_RESULTFields inherited from class org.apache.kafka.connect.source.SourceTask
context, TRANSACTION_BOUNDARY_CONFIG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidClose any resources the source has open.protected SourceCommonConfigconfigure(Map<String, String> props, OffsetManager offsetManager) Called byAbstractSourceTask.start(java.util.Map<java.lang.String, java.lang.String>)to allows the concrete implementation to configure itself based on properties.protected EvolvingSourceRecordIteratorgetIterator(SourceCommonConfig config) Gets the iterator of SourceRecords.version()Methods inherited from class io.aiven.commons.kafka.connector.source.AbstractSourceTask
isRunning, lastEvolution, poll, start, stillPolling, stopMethods inherited from class org.apache.kafka.connect.source.SourceTask
commit, commitRecord, commitRecord, initialize
-
Constructor Details
-
ExampleSourceTask
public ExampleSourceTask()Constructor.
-
-
Method Details
-
getIterator
Description copied from class:AbstractSourceTaskGets the iterator of SourceRecords. The iterator that SourceRecords are extracted from for a poll event. When this iterator runs out of records it should attempt to reset and read more records from the backend on the nexthasNext()call. In this way it should detect when new data has been added to the backend and continue processing.This method should handle any backend exception that can be retried. Any runtime exceptions that are thrown when this iterator executes may cause the task to abort.
- Specified by:
getIteratorin classAbstractSourceTask- Parameters:
config- the SourceCommonConfig instance.- Returns:
- The iterator of SourceRecords.
-
configure
Description copied from class:AbstractSourceTaskCalled byAbstractSourceTask.start(java.util.Map<java.lang.String, java.lang.String>)to allows the concrete implementation to configure itself based on properties.- Specified by:
configurein classAbstractSourceTask- Parameters:
props- The properties to use for configuration.offsetManager- the OffsetManager to use.- Returns:
- A SourceCommonConfig based configuration.
-
closeResources
protected void closeResources()Description copied from class:AbstractSourceTaskClose any resources the source has open. Called when stopping.- Specified by:
closeResourcesin classAbstractSourceTask
-
version
-