Package org.apache.kafka.connect.tools
Class MockSourceConnector
java.lang.Object
org.apache.kafka.connect.connector.Connector
org.apache.kafka.connect.source.SourceConnector
org.apache.kafka.connect.tools.MockSourceConnector
- All Implemented Interfaces:
Versioned
Mock source implementation which delegates to
MockConnector
.-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionconfig()
Define the configuration for the connector.void
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 this Connector.void
stop()
Stop this connector.Returns theTask
implementation for this Connector.taskConfigs
(int maxTasks) Returns a set of configurations for Tasks based on the current configuration, producing at mostmaxTasks
configurations.Validate the connector configuration values against configuration definitions.version()
Get the version of this component.Methods inherited from class org.apache.kafka.connect.source.SourceConnector
alterOffsets, canDefineTransactionBoundaries, context, exactlyOnceSupport
-
Constructor Details
-
MockSourceConnector
public MockSourceConnector()
-
-
Method Details
-
initialize
Description copied from class:Connector
Initialize this connector, using the provided ConnectorContext to notify the runtime of input configuration changes.- Overrides:
initialize
in classConnector
- Parameters:
ctx
- context object used to interact with the Kafka Connect runtime
-
initialize
Description copied from class: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.
- Overrides:
initialize
in classConnector
- Parameters:
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 assignments
-
reconfigure
Description copied from class:Connector
Reconfigure this Connector. Most implementations will not override this, using the default implementation that callsConnector.stop()
followed byConnector.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.- Overrides:
reconfigure
in classConnector
- Parameters:
props
- new configuration settings
-
validate
Description copied from class:Connector
Validate the connector configuration values against configuration definitions. -
version
Description copied from interface:Versioned
Get the version of this component.- Returns:
- the version, formatted as a String. The version may not be
null
or empty.
-
start
Description copied from class:Connector
Start this Connector. This method will only be called on a clean Connector, i.e. it has either just been instantiated and initialized orConnector.stop()
has been invoked. -
taskClass
Description copied from class:Connector
Returns theTask
implementation for this Connector. -
taskConfigs
Description copied from class:Connector
Returns a set of configurations for Tasks based on the current configuration, producing at mostmaxTasks
configurations.- Specified by:
taskConfigs
in classConnector
- Parameters:
maxTasks
- maximum number of configurations to generate- Returns:
- configurations for Tasks
-
stop
public void stop()Description copied from class:Connector
Stop this connector. -
config
Description copied from class:Connector
Define the configuration for the connector.
-