Class MockSinkConnector

All Implemented Interfaces:
Versioned

public class MockSinkConnector extends SinkConnector
Mock sink implementation which delegates to MockConnector.
  • Constructor Details

    • MockSinkConnector

      public MockSinkConnector()
  • Method Details

    • initialize

      public void initialize(ConnectorContext ctx)
      Description copied from class: Connector
      Initialize this connector, using the provided ConnectorContext to notify the runtime of input configuration changes.
      Overrides:
      initialize in class Connector
      Parameters:
      ctx - context object used to interact with the Kafka Connect runtime
    • initialize

      public void initialize(ConnectorContext ctx, List<Map<String,String>> taskConfigs)
      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 class Connector
      Parameters:
      ctx - context object used to interact with the Kafka Connect runtime
      taskConfigs - existing task configurations, which may be used when generating new task configs to avoid churn in partition to task assignments
    • reconfigure

      public void reconfigure(Map<String,String> props)
      Description copied from class: Connector
      Reconfigure this Connector. Most implementations will not override this, using the default implementation that calls 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.
      Overrides:
      reconfigure in class Connector
      Parameters:
      props - new configuration settings
    • validate

      public Config validate(Map<String,String> connectorConfigs)
      Description copied from class: Connector
      Validate the connector configuration values against configuration definitions.
      Overrides:
      validate in class Connector
      Parameters:
      connectorConfigs - the provided configuration values
      Returns:
      a parsed and validated Config containing any relevant validation errors with the raw connectorConfigs which should prevent this configuration from being used.
    • version

      public String 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

      public void start(Map<String,String> props)
      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 or Connector.stop() has been invoked.
      Specified by:
      start in class Connector
      Parameters:
      props - configuration settings
    • taskClass

      public Class<? extends Task> taskClass()
      Description copied from class: Connector
      Returns the Task implementation for this Connector.
      Specified by:
      taskClass in class Connector
    • taskConfigs

      public List<Map<String,String>> taskConfigs(int maxTasks)
      Description copied from class: Connector
      Returns a set of configurations for Tasks based on the current configuration, producing at most maxTasks configurations.
      Specified by:
      taskConfigs in class Connector
      Parameters:
      maxTasks - maximum number of configurations to generate
      Returns:
      configurations for Tasks
    • stop

      public void stop()
      Description copied from class: Connector
      Stop this connector.
      Specified by:
      stop in class Connector
    • config

      public ConfigDef config()
      Description copied from class: Connector
      Define the configuration for the connector.
      Specified by:
      config in class Connector
      Returns:
      The ConfigDef for this connector; may not be null.