Modifier and Type | Field and Description |
---|---|
protected SourceTaskContext |
context |
Constructor and Description |
---|
SourceTask() |
Modifier and Type | Method and Description |
---|---|
void |
commit()
Commit the offsets, up to the offsets that have been returned by
poll() . |
void |
commitRecord(SourceRecord record)
Commit an individual
SourceRecord when the callback from the producer client is received, or if a record is filtered by a transformation. |
void |
initialize(SourceTaskContext context)
Initialize this SourceTask with the specified context object.
|
abstract java.util.List<SourceRecord> |
poll()
Poll this SourceTask for new records.
|
abstract void |
start(java.util.Map<java.lang.String,java.lang.String> props)
Start the Task.
|
abstract void |
stop()
Signal this SourceTask to stop.
|
protected SourceTaskContext context
public void initialize(SourceTaskContext context)
public abstract void start(java.util.Map<java.lang.String,java.lang.String> props)
public abstract java.util.List<SourceRecord> poll() throws java.lang.InterruptedException
java.lang.InterruptedException
public void commit() throws java.lang.InterruptedException
Commit the offsets, up to the offsets that have been returned by poll()
. This
method should block until the commit is complete.
SourceTasks are not required to implement this functionality; Kafka Connect will record offsets automatically. This hook is provided for systems that also need to store offsets internally in their own system.
java.lang.InterruptedException
public abstract void stop()
poll()
and
commit()
.
For example, if a task uses a Selector
to receive data over the network, this method
could set a flag that will force poll()
to exit immediately and invoke
wakeup()
to interrupt any ongoing requests.public void commitRecord(SourceRecord record) throws java.lang.InterruptedException
Commit an individual SourceRecord
when the callback from the producer client is received, or if a record is filtered by a transformation.
SourceTasks are not required to implement this functionality; Kafka Connect will record offsets automatically. This hook is provided for systems that also need to store offsets internally in their own system.
record
- SourceRecord
that was successfully sent via the producer.java.lang.InterruptedException