Interface ConfigProvider

All Superinterfaces:
AutoCloseable, Closeable, Configurable
All Known Implementing Classes:
DirectoryConfigProvider, EnvVarConfigProvider, FileConfigProvider

public interface ConfigProvider extends Configurable, Closeable
A provider of configuration data, which may optionally support subscriptions to configuration changes. Implementations are required to safely support concurrent calls to any of the methods in this interface. Kafka Connect discovers configuration providers using Java's Service Provider mechanism (see java.util.ServiceLoader). To support this, implementations of this interface should also contain a service provider configuration file in META-INF/service/org.apache.kafka.common.config.provider.ConfigProvider.
  • Method Details

    • get

      ConfigData get(String path)
      Retrieves the data at the given path.
      Parameters:
      path - the path where the data resides
      Returns:
      the configuration data
    • get

      ConfigData get(String path, Set<String> keys)
      Retrieves the data with the given keys at the given path.
      Parameters:
      path - the path where the data resides
      keys - the keys whose values will be retrieved
      Returns:
      the configuration data
    • subscribe

      default void subscribe(String path, Set<String> keys, ConfigChangeCallback callback)
      Subscribes to changes for the given keys at the given path (optional operation).
      Parameters:
      path - the path where the data resides
      keys - the keys whose values will be retrieved
      callback - the callback to invoke upon change
    • unsubscribe

      default void unsubscribe(String path, Set<String> keys, ConfigChangeCallback callback)
      Unsubscribes to changes for the given keys at the given path (optional operation).
      Parameters:
      path - the path where the data resides
      keys - the keys whose values will be retrieved
      callback - the callback to be unsubscribed from changes
    • unsubscribeAll

      default void unsubscribeAll()
      Clears all subscribers (optional operation).