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.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconfig()Define the configuration for the connector.voidInitialize this connector, using the provided ConnectorContext to notify the runtime of input configuration changes.voidinitialize(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.voidreconfigure(Map<String, String> props) Reconfigure this Connector.voidStart this Connector.voidstop()Stop this connector.Returns theTaskimplementation for this Connector.taskConfigs(int maxTasks) Returns a set of configurations for Tasks based on the current configuration, producing at mostmaxTasksconfigurations.Validate the connector configuration values against configuration definitions.version()Get the version of this component.Methods inherited from class SourceConnector
alterOffsets, canDefineTransactionBoundaries, exactlyOnceSupport
-
Constructor Details
-
MockSourceConnector
public MockSourceConnector()
-
-
Method Details
-
initialize
Description copied from class:ConnectorInitialize this connector, using the provided ConnectorContext to notify the runtime of input configuration changes.- Overrides:
initializein classConnector- Parameters:
ctx- context object used to interact with the Kafka Connect runtime
-
initialize
Description copied from class:ConnectorInitialize 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:
initializein 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:ConnectorReconfigure 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:
reconfigurein classConnector- Parameters:
props- new configuration settings
-
validate
Description copied from class:ConnectorValidate the connector configuration values against configuration definitions. -
version
-
start
Description copied from class:ConnectorStart 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
-
taskConfigs
Description copied from class:ConnectorReturns a set of configurations for Tasks based on the current configuration, producing at mostmaxTasksconfigurations.- Specified by:
taskConfigsin classConnector- Parameters:
maxTasks- maximum number of configurations to generate- Returns:
- configurations for Tasks
-
stop
-
config
-