public abstract class BaseSourceTask
extends org.apache.kafka.connect.source.SourceTask
SourceTask implementations. Provides functionality common to all connectors,
such as validation of the configuration.| Modifier and Type | Class and Description |
|---|---|
protected static class |
BaseSourceTask.State |
| Modifier and Type | Field and Description |
|---|---|
private ChangeEventSourceCoordinator |
coordinator
The change event source coordinator for those connectors adhering to the new
framework structure,
null for legacy-style connectors. |
private Map<String,?> |
lastOffset
The latest offset that has been acknowledged by the Kafka producer.
|
private static org.slf4j.Logger |
LOGGER |
protected AtomicReference<BaseSourceTask.State> |
state |
| Constructor and Description |
|---|
BaseSourceTask() |
| Modifier and Type | Method and Description |
|---|---|
void |
commit() |
void |
commitRecord(org.apache.kafka.connect.source.SourceRecord record) |
protected abstract Iterable<Field> |
getAllConfigurationFields()
Returns all configuration
Field supported by this source task. |
protected OffsetContext |
getPreviousOffset(OffsetContext.Loader loader)
Loads the connector's persistent offset (if present) via the given loader.
|
protected abstract ChangeEventSourceCoordinator |
start(Configuration config)
Called once when starting this source task.
|
void |
start(Map<String,String> props) |
commitRecord, initialize, poll, stopprivate static final org.slf4j.Logger LOGGER
protected final AtomicReference<BaseSourceTask.State> state
private ChangeEventSourceCoordinator coordinator
null for legacy-style connectors.public final void start(Map<String,String> props)
start in interface org.apache.kafka.connect.connector.Taskstart in class org.apache.kafka.connect.source.SourceTaskprotected abstract ChangeEventSourceCoordinator start(Configuration config)
config - the task configuration; implementations should wrap it in a dedicated implementation of
CommonConnectorConfig and work with typed access to configuration properties that waypublic void commitRecord(org.apache.kafka.connect.source.SourceRecord record)
throws InterruptedException
commitRecord in class org.apache.kafka.connect.source.SourceTaskInterruptedExceptionpublic void commit()
throws InterruptedException
commit in class org.apache.kafka.connect.source.SourceTaskInterruptedExceptionprotected abstract Iterable<Field> getAllConfigurationFields()
Field supported by this source task.protected OffsetContext getPreviousOffset(OffsetContext.Loader loader)
Copyright © 2020 JBoss by Red Hat. All rights reserved.