public class MockSourceConnector extends SourceConnector
MockConnector
.Constructor and Description |
---|
MockSourceConnector() |
Modifier and Type | Method and Description |
---|---|
ConfigDef |
config()
Define the configuration for the connector.
|
void |
initialize(ConnectorContext ctx)
Initialize this connector, using the provided ConnectorContext to notify the runtime of
input configuration changes.
|
void |
initialize(ConnectorContext ctx,
List<Map<String,String>> taskConfigs)
Initialize this connector, using the provided ConnectorContext to notify the runtime of
input configuration changes and using the provided set of Task configurations.
|
void |
reconfigure(Map<String,String> props)
Reconfigure this Connector.
|
void |
start(Map<String,String> props)
Start this Connector.
|
void |
stop()
Stop this connector.
|
Class<? extends Task> |
taskClass()
Returns the
Task implementation for this Connector. |
List<Map<String,String>> |
taskConfigs(int maxTasks)
Returns a set of configurations for Tasks based on the current configuration,
producing at most
maxTasks configurations. |
Config |
validate(Map<String,String> connectorConfigs)
Validate the connector configuration values against configuration definitions.
|
String |
version()
Get the version of this component.
|
alterOffsets, canDefineTransactionBoundaries, context, exactlyOnceSupport
public void initialize(ConnectorContext ctx)
Connector
initialize
in class Connector
ctx
- context object used to interact with the Kafka Connect runtimepublic void initialize(ConnectorContext ctx, List<Map<String,String>> taskConfigs)
Connector
Initialize this connector, using the provided ConnectorContext to notify the runtime of input configuration changes and using the provided set of Task configurations. This version is only used to recover from failures.
The default implementation ignores the provided Task configurations. During recovery, Kafka Connect will request an updated set of configurations and update the running Tasks appropriately. However, Connectors should implement special handling of this case if it will avoid unnecessary changes to running Tasks.
initialize
in class Connector
ctx
- context object used to interact with the Kafka Connect runtimetaskConfigs
- existing task configurations, which may be used when generating new task configs to avoid
churn in partition to task assignmentspublic void reconfigure(Map<String,String> props)
Connector
Connector.stop()
followed by Connector.start(Map)
.
Implementations only need to override this if they want to handle this process more
efficiently, e.g. without shutting down network connections to the external system.reconfigure
in class Connector
props
- new configuration settingspublic Config validate(Map<String,String> connectorConfigs)
Connector
public String version()
Versioned
null
or empty.public void start(Map<String,String> props)
Connector
Connector.stop()
has been invoked.public Class<? extends Task> taskClass()
Connector
Task
implementation for this Connector.public List<Map<String,String>> taskConfigs(int maxTasks)
Connector
maxTasks
configurations.taskConfigs
in class Connector
maxTasks
- maximum number of configurations to generatepublic void stop()
Connector