public class SimpleSourceConnector
extends org.apache.kafka.connect.source.SourceConnector
SourceConnector for testing that reliably produces the same records in the same order, and useful
for testing the infrastructure to run SourceConnectors.
This connector produces messages with keys having a single monotonically-increasing integer field named id:
{
"id" : "1"
}
and values with a batch field containing the 1-based batch number, a record field containing the
1-based record number within the batch, and an optional timestamp field that contains a simulated number of
milliseconds past epoch computed by adding the start time of the connector task with the message id:
{
"batch" : "1",
"record" : "1",
"timestamp" : null
}
| Modifier and Type | Class and Description |
|---|---|
static class |
SimpleSourceConnector.SimpleConnectorTask |
| Modifier and Type | Field and Description |
|---|---|
static String |
BATCH_COUNT |
private Map<String,String> |
config |
static int |
DEFAULT_BATCH_COUNT |
static boolean |
DEFAULT_INCLUDE_TIMESTAMP |
static int |
DEFAULT_RECORD_COUNT_PER_BATCH |
static String |
DEFAULT_TOPIC_NAME |
static String |
INCLUDE_TIMESTAMP |
static String |
RECORD_COUNT_PER_BATCH |
static String |
RETRIABLE_ERROR_ON |
static String |
TOPIC_NAME |
protected static String |
VERSION |
| Constructor and Description |
|---|
SimpleSourceConnector() |
| Modifier and Type | Method and Description |
|---|---|
org.apache.kafka.common.config.ConfigDef |
config() |
void |
start(Map<String,String> props) |
void |
stop() |
Class<? extends org.apache.kafka.connect.connector.Task> |
taskClass() |
List<Map<String,String>> |
taskConfigs(int maxTasks) |
String |
version() |
protected static final String VERSION
public static final String TOPIC_NAME
public static final String RECORD_COUNT_PER_BATCH
public static final String BATCH_COUNT
public static final String DEFAULT_TOPIC_NAME
public static final String INCLUDE_TIMESTAMP
public static final String RETRIABLE_ERROR_ON
public static final int DEFAULT_RECORD_COUNT_PER_BATCH
public static final int DEFAULT_BATCH_COUNT
public static final boolean DEFAULT_INCLUDE_TIMESTAMP
public String version()
public void start(Map<String,String> props)
start in class org.apache.kafka.connect.connector.Connectorpublic Class<? extends org.apache.kafka.connect.connector.Task> taskClass()
taskClass in class org.apache.kafka.connect.connector.Connectorpublic List<Map<String,String>> taskConfigs(int maxTasks)
taskConfigs in class org.apache.kafka.connect.connector.Connectorpublic void stop()
stop in class org.apache.kafka.connect.connector.Connectorpublic org.apache.kafka.common.config.ConfigDef config()
config in class org.apache.kafka.connect.connector.ConnectorCopyright © 2021 JBoss by Red Hat. All rights reserved.